diff options
author | Mihai Bazon <mihai.bazon@gmail.com> | 2013-03-13 01:36:55 -0700 |
---|---|---|
committer | Mihai Bazon <mihai.bazon@gmail.com> | 2013-03-13 01:36:55 -0700 |
commit | 24e58ee70c1951e6b70a72ae372766c97ef2b6ea (patch) | |
tree | 9b0a3b01e1be725e1ca30e153aed0a30f7c4582e | |
parent | 9b1a40dfc3681ce6410afd6fbae1e72bd34f0901 (diff) | |
parent | f2767452e609cefecd8bff987c077d956b7b1534 (diff) | |
download | tracifyjs-24e58ee70c1951e6b70a72ae372766c97ef2b6ea.tar.gz tracifyjs-24e58ee70c1951e6b70a72ae372766c97ef2b6ea.zip |
Merge pull request #125 from devongovett/master
Allow inSourceMap option to be a generated JSON source map
-rw-r--r-- | tools/node.js | 21 |
1 files changed, 11 insertions, 10 deletions
diff --git a/tools/node.js b/tools/node.js index cf87628d..c0dd3dbc 100644 --- a/tools/node.js +++ b/tools/node.js @@ -92,17 +92,18 @@ exports.minify = function(files, options) { } // 4. output - var map = null; - var inMap = null; - if (options.inSourceMap) { + var inMap = options.inSourceMap; + var output = {}; + if (typeof options.inSourceMap == "string") { inMap = fs.readFileSync(options.inSourceMap, "utf8"); } - if (options.outSourceMap) map = UglifyJS.SourceMap({ - file: options.outSourceMap, - orig: inMap, - root: options.sourceRoot - }); - var output = { source_map: map }; + if (options.outSourceMap) { + output.source_map = UglifyJS.SourceMap({ + file: options.outSourceMap, + orig: inMap, + root: options.sourceRoot + }); + } if (options.output) { UglifyJS.merge(output, options.output); } @@ -110,7 +111,7 @@ exports.minify = function(files, options) { toplevel.print(stream); return { code : stream + "", - map : map + "" + map : output.source_map + "" }; }; |