[Pkg-javascript-commits] [less.js] 36/38: Use the parser for modify vars and global vars - Fixes additional \n in sourcemap content. Fixes #1761

Jonas Smedegaard dr at jones.dk
Mon Oct 26 23:27:30 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 4ddcf63d338573d70d0021f69e66869d7d593936
Author: Luke Page <luke.a.page at gmail.com>
Date:   Sun Jan 4 10:51:33 2015 +0000

    Use the parser for modify vars and global vars - Fixes additional \n in sourcemap content. Fixes #1761
---
 bin/lessc | 21 +++++++++++++--------
 1 file changed, 13 insertions(+), 8 deletions(-)

diff --git a/bin/lessc b/bin/lessc
index bc01932..b2607f7 100755
--- a/bin/lessc
+++ b/bin/lessc
@@ -27,8 +27,8 @@ var silent = false,
     ieCompat: true,
     strictMath: false,
     strictUnits: false,
-    globalVariables: '',
-    modifyVariables: '',
+    globalVars: null,
+    modifyVars: null,
     urlArgs: '',
     plugins: plugins
 };
@@ -59,9 +59,9 @@ var checkBooleanArg = function(arg) {
     return Boolean(onOff[2]);
 };
 
-var parseVariableOption = function(option) {
+var parseVariableOption = function(option, variables) {
     var parts = option.split('=', 2);
-    return '@' + parts[0] + ': ' + parts[1] + ';\n';
+    variables[parts[0]] = parts[1];
 };
 
 var warningMessages = "";
@@ -205,12 +205,19 @@ args = args.filter(function (arg) {
             break;
         case "global-var":
             if (checkArgFunc(arg, match[2])) {
-                options.globalVariables += parseVariableOption(match[2]);
+                if (!options.globalVars) {
+                    options.globalVars = {};
+                }
+                parseVariableOption(match[2], options.globalVars);
             }
             break;
         case "modify-var":
             if (checkArgFunc(arg, match[2])) {
-                options.modifyVariables += parseVariableOption(match[2]);
+                if (!options.modifyVars) {
+                    options.modifyVars = {};
+                }
+
+                parseVariableOption(match[2], options.modifyVars);
             }
             break;
         case 'url-args':
@@ -348,8 +355,6 @@ var parseLessFile = function (e, data) {
         return;
     }
 
-    data = options.globalVariables + data + '\n' + options.modifyVariables;
-
     options.paths = [path.dirname(input)].concat(options.paths);
     options.filename = input;
 

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