diff options
author | Yotam Spenser <yotam.s@walkme.com> | 2016-07-06 13:02:07 +0300 |
---|---|---|
committer | Richard van Velzen <rvanvelzen1@gmail.com> | 2016-07-17 19:39:08 +0200 |
commit | af37ecafe1c24e9fb06a371357d10a04446ff71e (patch) | |
tree | 635bcbd9548c35fde2379bac57c7410901ed31f8 /tools | |
parent | 41a9329409ca0f1273b6ccdcc9770713f44ec55a (diff) | |
download | tracifyjs-af37ecafe1c24e9fb06a371357d10a04446ff71e.tar.gz tracifyjs-af37ecafe1c24e9fb06a371357d10a04446ff71e.zip |
Source map URL override from programmatic API
Diffstat (limited to 'tools')
-rw-r--r-- | tools/node.js | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/tools/node.js b/tools/node.js index 2ee7df21..20ecb473 100644 --- a/tools/node.js +++ b/tools/node.js @@ -43,6 +43,7 @@ exports.minify = function(files, options) { outSourceMap : null, sourceRoot : null, inSourceMap : null, + sourceMapUrl : null, fromString : false, warnings : false, mangle : {}, @@ -136,8 +137,9 @@ exports.minify = function(files, options) { var stream = UglifyJS.OutputStream(output); toplevel.print(stream); - if (options.outSourceMap && "string" === typeof options.outSourceMap) { - stream += "\n//# sourceMappingURL=" + options.outSourceMap; + var mappingUrlPrefix = "\n//# sourceMappingURL="; + if (options.outSourceMap && typeof options.outSourceMap === "string" && options.sourceMapUrl !== false) { + stream += mappingUrlPrefix + (typeof options.sourceMapUrl === "string" ? options.sourceMapUrl : options.outSourceMap); } var source_map = output.source_map; |