Skip to content

Commit

Permalink
change use case and add test
Browse files Browse the repository at this point in the history
  • Loading branch information
bassjobsen committed Feb 28, 2015
1 parent 57def23 commit 6c66aeb
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 2 deletions.
2 changes: 1 addition & 1 deletion lib/less/tree/import.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ Import.prototype.accept = function (visitor) {
}
};
Import.prototype.genCSS = function (context, output) {
if (this.css && this.options.reference === undefined) {
if (this.css && this.path.currentFileInfo.reference === undefined) {
output.add("@import ", this.currentFileInfo, this.index);
this.path.genCSS(context, output);
if (this.features) {
Expand Down
7 changes: 7 additions & 0 deletions lib/less/visitors/to-css-visitor.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,13 @@ ToCSSVisitor.prototype = {
return mediaNode;
},

visitImport: function (importNode, visitArgs) {
if (importNode.path.currentFileInfo.reference !== undefined && importNode.css) {
return;
}
return importNode;
},

visitDirective: function(directiveNode, visitArgs) {
if (directiveNode.name === "@charset") {
if (!directiveNode.getIsReferenced()) {
Expand Down
3 changes: 2 additions & 1 deletion test/less/import-reference.less
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
@import (reference) url("css-3.less");
@import (reference) url("media.less");
@import (reference) url("import/import-reference.less");
@import (reference) url("import/css-import.less");

.b {
.z();
Expand All @@ -20,4 +21,4 @@
.class:extend(.class all) {
}
.mixin-with-nested-selectors();
.mixin-with-directives(some-name);
.mixin-with-directives(some-name);
1 change: 1 addition & 0 deletions test/less/import/css-import.less
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
@import url("test.css");

0 comments on commit 6c66aeb

Please sign in to comment.