Merge 938df1b024 into b5a7197ae5
This commit is contained in:
commit
1f88ea0cc8
|
|
@ -54,12 +54,15 @@ exports.minify = function(files, options) {
|
||||||
if (typeof files == "string")
|
if (typeof files == "string")
|
||||||
files = [ files ];
|
files = [ files ];
|
||||||
files.forEach(function(file, i){
|
files.forEach(function(file, i){
|
||||||
|
var filename = options.fromString
|
||||||
|
? (typeof file === 'object' ? file.filename : i)
|
||||||
|
: file;
|
||||||
var code = options.fromString
|
var code = options.fromString
|
||||||
? file
|
? (typeof file === 'object' ? file.content : file)
|
||||||
: fs.readFileSync(file, "utf8");
|
: fs.readFileSync(filename, "utf8");
|
||||||
sourcesContent[file] = code;
|
sourcesContent[filename] = code;
|
||||||
toplevel = UglifyJS.parse(code, {
|
toplevel = UglifyJS.parse(code, {
|
||||||
filename: options.fromString ? i : file,
|
filename: filename,
|
||||||
toplevel: toplevel
|
toplevel: toplevel
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user