Merge 883fb2177e into fcde6109b0
This commit is contained in:
commit
833beabf34
|
|
@ -54,12 +54,14 @@ exports.minify = function(files, options) {
|
||||||
options = UglifyJS.defaults(options, {
|
options = UglifyJS.defaults(options, {
|
||||||
spidermonkey : false,
|
spidermonkey : false,
|
||||||
outSourceMap : null,
|
outSourceMap : null,
|
||||||
|
sourceMapURL : null,
|
||||||
sourceRoot : null,
|
sourceRoot : null,
|
||||||
inSourceMap : null,
|
inSourceMap : null,
|
||||||
fromString : false,
|
fromString : false,
|
||||||
warnings : false,
|
warnings : false,
|
||||||
mangle : {},
|
mangle : {},
|
||||||
output : null,
|
output : null,
|
||||||
|
prefix : null,
|
||||||
compress : {}
|
compress : {}
|
||||||
});
|
});
|
||||||
UglifyJS.base54.reset();
|
UglifyJS.base54.reset();
|
||||||
|
|
@ -77,6 +79,11 @@ exports.minify = function(files, options) {
|
||||||
var code = options.fromString
|
var code = options.fromString
|
||||||
? file
|
? file
|
||||||
: fs.readFileSync(file, "utf8");
|
: fs.readFileSync(file, "utf8");
|
||||||
|
|
||||||
|
if (options.prefix !== null) {
|
||||||
|
file = '/' + file.replace(/^\/+/, "").split(/\/+/).slice(options.prefix).join("/");
|
||||||
|
}
|
||||||
|
|
||||||
sourcesContent[file] = code;
|
sourcesContent[file] = code;
|
||||||
toplevel = UglifyJS.parse(code, {
|
toplevel = UglifyJS.parse(code, {
|
||||||
filename: options.fromString ? i : file,
|
filename: options.fromString ? i : file,
|
||||||
|
|
@ -131,7 +138,9 @@ exports.minify = function(files, options) {
|
||||||
var stream = UglifyJS.OutputStream(output);
|
var stream = UglifyJS.OutputStream(output);
|
||||||
toplevel.print(stream);
|
toplevel.print(stream);
|
||||||
|
|
||||||
if(options.outSourceMap){
|
if(options.sourceMapURL){
|
||||||
|
stream += "\n//# sourceMappingURL=" + options.sourceMapURL;
|
||||||
|
} else if(options.outSourceMap){
|
||||||
stream += "\n//# sourceMappingURL=" + options.outSourceMap;
|
stream += "\n//# sourceMappingURL=" + options.outSourceMap;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user