aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMihai Bazon <mihai@bazon.net>2012-10-20 11:14:25 +0300
committerMihai Bazon <mihai@bazon.net>2012-10-20 11:14:25 +0300
commitbee01dc1bec7d76a323bc4570cdba869c42ad447 (patch)
tree716442633746ddadcf40f50822478d9be3940e00
parent12f71e01d02a2f4cc76cb8471036992e0cba9cf1 (diff)
parent3a72deacab4d2f5fea3399233565c8a62267c783 (diff)
downloadtracifyjs-bee01dc1bec7d76a323bc4570cdba869c42ad447.tar.gz
tracifyjs-bee01dc1bec7d76a323bc4570cdba869c42ad447.zip
Merge branch 'master' of github.com:mishoo/UglifyJS2
-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 86df2a9f..de749bb3 100644
--- a/tools/node.js
+++ b/tools/node.js
@@ -63,6 +63,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,
@@ -102,7 +103,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);