[Pkg-javascript-commits] [less.js] 20/38: Fix problem if you use import inline and import interpolation together. Fixes #2336

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


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

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

commit 9ba40925a9bcb6544746905c3a4cf4104608d083
Author: Luke Page <luke.a.page at gmail.com>
Date:   Sat Jan 3 09:02:38 2015 +0000

    Fix problem if you use import inline and import interpolation together. Fixes #2336
---
 lib/less/tree/ruleset.js                   | 3 ++-
 test/css/import-interpolation.css          | 6 ++++++
 test/less/import/import-interpolation.less | 1 +
 3 files changed, 9 insertions(+), 1 deletion(-)

diff --git a/lib/less/tree/ruleset.js b/lib/less/tree/ruleset.js
index 35653bb..aa86214 100644
--- a/lib/less/tree/ruleset.js
+++ b/lib/less/tree/ruleset.js
@@ -220,7 +220,8 @@ Ruleset.prototype.variables = function () {
             }
             // 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) {
+	        // guard against root being a string (in the case of inlined less)
+            if (r.type === "Import" && r.root && r.root.variables) {
                 var vars = r.root.variables();
                 for(var name in vars) {
                     if (vars.hasOwnProperty(name)) {
diff --git a/test/css/import-interpolation.css b/test/css/import-interpolation.css
index 16b7a15..bb7b1a1 100644
--- a/test/css/import-interpolation.css
+++ b/test/css/import-interpolation.css
@@ -1,6 +1,12 @@
 body {
   width: 100%;
 }
+#logo {
+  width: 100px;
+  height: 100px;
+  background: url('../assets/logo.png');
+}
+
 .a {
   var: test;
 }
diff --git a/test/less/import/import-interpolation.less b/test/less/import/import-interpolation.less
index aa49a70..656f3cb 100644
--- a/test/less/import/import-interpolation.less
+++ b/test/less/import/import-interpolation.less
@@ -1 +1,2 @@
+ at import (inline) "imports/logo.less";
 @import "import-@{in}@{terpolation}2.less";
\ No newline at end of file

-- 
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