From a9aa85517fa4f6fe968562172396431769f81dc9 Mon Sep 17 00:00:00 2001 From: Yotam Spenser Date: Wed, 6 Jul 2016 13:02:07 +0300 Subject: [PATCH] Source map URL override from programmatic API --- tools/node.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/tools/node.js b/tools/node.js index 2ee7df21..e1e6d689 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") { + stream += mappingUrlPrefix + (typeof options.sourceMapUrl === "string" ? options.sourceMapUrl : options.outSourceMap); } var source_map = output.source_map;