diff --git a/bin/lessc b/bin/lessc index acb3d67b..4cb1d00b 100755 --- a/bin/lessc +++ b/bin/lessc @@ -154,6 +154,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; @@ -201,7 +206,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 92eddf27..cc846266 100644 --- a/lib/less/lessc_helper.js +++ b/lib/less/lessc_helper.js @@ -54,6 +54,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."); diff --git a/lib/less/source-map-output.js b/lib/less/source-map-output.js index 8d2b7c6e..821cfc9f 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'));