aboutsummaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
author1111hui <26634873@qq.com>2016-10-29 15:21:28 +0800
committerRichard van Velzen <rvanvelzen1@gmail.com>2016-11-29 20:29:12 +0100
commit0a35acbbe7e663c643c5b227e455816278e08b89 (patch)
tree6e1daafa47e2ccc87e973e6a2a95ca62a4003244 /tools
parent2a9989dd18c01081c486fe9089e3bb64079c773b (diff)
downloadtracifyjs-0a35acbbe7e663c643c5b227e455816278e08b89.tar.gz
tracifyjs-0a35acbbe7e663c643c5b227e455816278e08b89.zip
feat: add option.outFileName for JS API, if absense, sourceMap.file field will deduced
Diffstat (limited to 'tools')
-rw-r--r--tools/node.js4
1 files changed, 3 insertions, 1 deletions
diff --git a/tools/node.js b/tools/node.js
index a16169b1..0b2d5197 100644
--- a/tools/node.js
+++ b/tools/node.js
@@ -41,6 +41,7 @@ exports.minify = function(files, options) {
options = UglifyJS.defaults(options, {
spidermonkey : false,
outSourceMap : null,
+ outFileName : null,
sourceRoot : null,
inSourceMap : null,
sourceMapUrl : null,
@@ -120,7 +121,8 @@ exports.minify = function(files, options) {
}
if (options.outSourceMap || options.sourceMapInline) {
output.source_map = UglifyJS.SourceMap({
- file: options.outSourceMap,
+ // prefer outFileName, otherwise use outSourceMap without .map suffix
+ file: options.outFileName || (typeof options.outSourceMap === 'string' ? options.outSourceMap.replace(/\.map$/i, '') : null),
orig: inMap,
root: options.sourceRoot
});