variables in media queries in import statements

This commit is contained in:
Luke Page
2013-02-16 14:44:58 +00:00
parent ab3ddf413d
commit d70769bfb7
4 changed files with 10 additions and 4 deletions

View File

@@ -1196,6 +1196,7 @@ less.Parser = function Parser(env) {
if (dir && (path = $(this.entities.quoted) || $(this.entities.url))) {
features = $(this.mediaFeatures);
if ($(';')) {
features = features && new(tree.Value)(features);
var importOnce = dir[1] !== 'multiple';
return new(tree.Import)(path, imports, features, importOnce, index, env.rootpath);
}

View File

@@ -17,7 +17,7 @@ tree.Import = function (path, imports, features, once, index, rootpath) {
this.once = once;
this.index = index;
this._path = path;
this.features = features && new(tree.Value)(features);
this.features = features;
this.rootpath = rootpath;
// The '.less' extension is optional
@@ -33,7 +33,7 @@ tree.Import = function (path, imports, features, once, index, rootpath) {
if (! this.css) {
imports.push(this.path, function (e, root, imported) {
if (e) { e.index = index; }
if (imported && that.once) that.skip = imported;
if (imported && that.once) { that.skip = imported; }
that.root = root || new(tree.Ruleset)([], []);
});
}
@@ -65,10 +65,10 @@ tree.Import.prototype = {
eval: function (env) {
var ruleset, features = this.features && this.features.eval(env);
if (this.skip) return [];
if (this.skip) { return []; }
if (this.css) {
return this;
return new(tree.Import)(this._path, null, features, this.once, this.index, this.rootpath);
} else {
ruleset = new(tree.Ruleset)([], this.root.rules.slice(0));