lib/less/js/lib/less/tree/ruleset.js in less-2.0.9 vs lib/less/js/lib/less/tree/ruleset.js in less-2.0.10

- old
+ new

@@ -1,25 +1,26 @@ (function (tree) { -tree.Ruleset = function (selectors, rules) { +tree.Ruleset = function (selectors, rules, strictImports) { this.selectors = selectors; this.rules = rules; this._lookups = {}; + this.strictImports = strictImports; }; tree.Ruleset.prototype = { eval: function (env) { var selectors = this.selectors && this.selectors.map(function (s) { return s.eval(env) }); - var ruleset = new(tree.Ruleset)(selectors, this.rules.slice(0)); + var ruleset = new(tree.Ruleset)(selectors, this.rules.slice(0), this.strictImports); ruleset.root = this.root; ruleset.allowImports = this.allowImports; // push the current ruleset to the frames stack env.frames.unshift(ruleset); // Evaluate imports - if (ruleset.root || ruleset.allowImports) { + if (ruleset.root || ruleset.allowImports || !ruleset.strictImports) { for (var i = 0; i < ruleset.rules.length; i++) { if (ruleset.rules[i] instanceof tree.Import) { Array.prototype.splice .apply(ruleset.rules, [i, 1].concat(ruleset.rules[i].eval(env))); } @@ -128,10 +129,10 @@ // Compile rules and rulesets for (var i = 0; i < this.rules.length; i++) { rule = this.rules[i]; - if (rule.rules || (rule instanceof tree.Directive)) { + if (rule.rules || (rule instanceof tree.Directive) || (rule instanceof tree.Media)) { rulesets.push(rule.toCSS(paths, env)); } else if (rule instanceof tree.Comment) { if (!rule.silent) { if (this.root) { rulesets.push(rule.toCSS(env));