aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMihai Bazon <mihai.bazon@gmail.com>2012-10-19 04:29:40 -0700
committerMihai Bazon <mihai.bazon@gmail.com>2012-10-19 04:29:40 -0700
commit3a72deacab4d2f5fea3399233565c8a62267c783 (patch)
tree85e97675eed0792fcd1d835ef6ef1a270a6fc4ec
parentfc8314e810c91431cd18fa9a784adb7867726013 (diff)
parent11dffe950ed5beb1bbf224a594cf0fae7dc11f9a (diff)
downloadtracifyjs-3a72deacab4d2f5fea3399233565c8a62267c783.tar.gz
tracifyjs-3a72deacab4d2f5fea3399233565c8a62267c783.zip
Merge pull request #19 from SevInf/master
Allow to specify sourceRoot in minify
-rw-r--r--README.md8
-rw-r--r--tools/node.js4
2 files changed, 11 insertions, 1 deletions
diff --git a/README.md b/README.md
index f519c119..4bf29b20 100644
--- a/README.md
+++ b/README.md
@@ -343,6 +343,14 @@ Note that the source map is not saved in a file, it's just returned in
`result.map`. The value passed for `outSourceMap` is only used to set the
`file` attribute in the source map (see [the spec][sm-spec]).
+You can also specify sourceRoot property to be included in source map:
+
+ var result = UglifyJS.minify([ "file1.js", "file2.js", "file3.js" ], {
+ outSourceMap: "out.js.map",
+ sourceRoot: "http://example.com/src"
+ });
+
+
If you're compressing compiled JavaScript and have a source map for it, you
can use the `inSourceMap` argument:
diff --git a/tools/node.js b/tools/node.js
index 6a21710a..80cc1858 100644
--- a/tools/node.js
+++ b/tools/node.js
@@ -65,6 +65,7 @@ for (var i in UglifyJS) {
exports.minify = function(files, options) {
options = UglifyJS.defaults(options, {
outSourceMap : null,
+ sourceRoot : null,
inSourceMap : null,
fromString : false,
warnings : false,
@@ -104,7 +105,8 @@ exports.minify = function(files, options) {
}
if (options.outSourceMap) map = UglifyJS.SourceMap({
file: options.outSourceMap,
- orig: inMap
+ orig: inMap,
+ root: options.sourceRoot
});
var stream = UglifyJS.OutputStream({ source_map: map });
toplevel.print(stream);