[Pkg-javascript-commits] [less.js] 225/285: when finding variables, look inside sub import nodes

Jonas Smedegaard dr at jones.dk
Mon Oct 26 23:23:56 UTC 2015


This is an automated email from the git hooks/post-receive script.

js pushed a commit to annotated tag v2.0.0
in repository less.js.

commit b4ae1e880f324d31749c71be04bd57c823e9cecc
Author: Luke Page <luke.a.page at gmail.com>
Date:   Thu Oct 23 18:33:13 2014 +0100

    when finding variables, look inside sub import nodes
---
 lib/less/tree/ruleset.js | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/lib/less/tree/ruleset.js b/lib/less/tree/ruleset.js
index 9895263..1dc3fda 100644
--- a/lib/less/tree/ruleset.js
+++ b/lib/less/tree/ruleset.js
@@ -218,6 +218,16 @@ Ruleset.prototype.variables = function () {
             if (r instanceof Rule && r.variable === true) {
                 hash[r.name] = r;
             }
+            // when evaluating variables in an import statement, imports have not been eval'd
+            // so we need to go inside import statements.
+            if (r.type === "Import" && r.root) {
+                var vars = r.root.variables();
+                for(var name in vars) {
+                    if (vars.hasOwnProperty(name)) {
+                        hash[name] = vars[name];
+                    }
+                }
+            }
             return hash;
         }, {});
     }

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/less.js.git



More information about the Pkg-javascript-commits mailing list