From 5ef2ff1707a70a2c41691bb23ae58b17437dbd77 Mon Sep 17 00:00:00 2001 From: Anders Johansson Date: Wed, 11 Sep 2013 13:35:52 +0200 Subject: [PATCH 1/2] Added --source-map-basepath option --- bin/lessc | 7 ++++++- lib/less/lessc_helper.js | 1 + 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/bin/lessc b/bin/lessc index c830488b3..166f7ce3e 100755 --- a/bin/lessc +++ b/bin/lessc @@ -150,6 +150,11 @@ args = args.filter(function (arg) { options.sourceMapRootpath = match[2]; } break; + case 'source-map-basepath': + if (checkArgFunc(arg, match[2])) { + options.sourceMapBasepath = match[2]; + } + break; case 'source-map-inline': options.outputSourceFiles = true; break; @@ -197,7 +202,7 @@ if (output) { } } -options.sourceMapBasepath = process.cwd(); +options.sourceMapBasepath = options.sourceMapBasepath || process.cwd(); if (options.sourceMap === true) { if (!output) { diff --git a/lib/less/lessc_helper.js b/lib/less/lessc_helper.js index 14e70cca3..d180f4060 100644 --- a/lib/less/lessc_helper.js +++ b/lib/less/lessc_helper.js @@ -53,6 +53,7 @@ var lessc_helper = { sys.puts(" format, and 'all' which will do both."); sys.puts(" --source-map[=FILENAME] Outputs a v3 sourcemap to the filename (or output filename.map)"); sys.puts(" --source-map-rootpath=X adds this path onto the sourcemap filename and less file paths"); + sys.puts(" --source-map-basepath=X Sets sourcemap base path, defaults to current working directory."); sys.puts(" --source-map-inline puts the less files into the map instead of referencing them"); sys.puts(" -rp, --rootpath=URL Set rootpath for url rewriting in relative imports and urls."); sys.puts(" Works with or without the relative-urls option."); From bab31952ff77bfa9de09ed0551ed306275df620d Mon Sep 17 00:00:00 2001 From: Anders Johansson Date: Wed, 11 Sep 2013 13:48:50 +0200 Subject: [PATCH 2/2] Normalize path for sourceMappingURL. --- lib/less/source-map-output.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/less/source-map-output.js b/lib/less/source-map-output.js index 8d2b7c6ef..821cfc9f3 100644 --- a/lib/less/source-map-output.js +++ b/lib/less/source-map-output.js @@ -80,11 +80,11 @@ this._writeSourceMap(JSON.stringify(this._sourceMapGenerator.toJSON())); if (this._sourceMapFilename) { - this._css.push("/*# sourceMappingURL=" + this._sourceMapRootpath + this._sourceMapFilename + " */"); + this._css.push("/*# sourceMappingURL=" + this.normalizeFilename(this._sourceMapFilename) + " */"); } } return this._css.join(''); }; -})(require('./tree')); \ No newline at end of file +})(require('./tree'));