diff options
author | Artemy Tregubenko <me@arty.name> | 2014-01-09 15:12:00 +0100 |
---|---|---|
committer | Artemy Tregubenko <me@arty.name> | 2014-01-09 15:12:00 +0100 |
commit | 03cf94ebe8b7bc87eccde800705beabf012ff275 (patch) | |
tree | 226c23d1f3a679f3ce0d3678dcbe6249ce9187e6 /tools | |
parent | c3087dd179bcef93626ae8227bf8f0ac5baa15a2 (diff) | |
download | tracifyjs-03cf94ebe8b7bc87eccde800705beabf012ff275.tar.gz tracifyjs-03cf94ebe8b7bc87eccde800705beabf012ff275.zip |
Added support for sourcesContent property of source map
Diffstat (limited to 'tools')
-rw-r--r-- | tools/node.js | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/tools/node.js b/tools/node.js index 7e6a38df..4dfa9338 100644 --- a/tools/node.js +++ b/tools/node.js @@ -64,7 +64,8 @@ exports.minify = function(files, options) { UglifyJS.base54.reset(); // 1. parse - var toplevel = null; + var toplevel = null, + sourcesContent = {}; if (options.spidermonkey) { toplevel = UglifyJS.AST_Node.from_mozilla_ast(files); @@ -75,6 +76,7 @@ exports.minify = function(files, options) { var code = options.fromString ? file : fs.readFileSync(file, "utf8"); + sourcesContent[file] = code; toplevel = UglifyJS.parse(code, { filename: options.fromString ? "?" : file, toplevel: toplevel @@ -110,6 +112,12 @@ exports.minify = function(files, options) { orig: inMap, root: options.sourceRoot }); + if (options.sourceMapIncludeSources) { + for (var file in sourcesContent) { + options.source_map.get().setSourceContent(file, sourcesContent[file]); + } + } + } if (options.output) { UglifyJS.merge(output, options.output); |