Add sourceMapURL option.

Same as `--source-map-url` in CLI.
This commit is contained in:
Brandon Frohs 2013-04-22 12:37:12 -04:00
parent 68394eed93
commit 1a5fe196b3

View File

@ -52,6 +52,7 @@ for (var i in UglifyJS) {
exports.minify = function(files, options) { exports.minify = function(files, options) {
options = UglifyJS.defaults(options, { options = UglifyJS.defaults(options, {
outSourceMap : null, outSourceMap : null,
sourceMapURL : null,
sourceRoot : null, sourceRoot : null,
inSourceMap : null, inSourceMap : null,
fromString : false, fromString : false,
@ -110,7 +111,7 @@ exports.minify = function(files, options) {
var stream = UglifyJS.OutputStream(output); var stream = UglifyJS.OutputStream(output);
toplevel.print(stream); toplevel.print(stream);
return { return {
code : stream + "", code : stream + (output.source_map ? "\n//@ sourceMappingURL=" + (options.sourceMapURL || options.outSourceMap) : ""),
map : output.source_map + "" map : output.source_map + ""
}; };
}; };