fromString option, use index from argument array for filename instead of "?"
The index allows the caller to map things like parse errors back to the code chunk where they appeared.
This commit is contained in:
parent
5bf617ebde
commit
4fba3e0b80
|
|
@ -73,13 +73,13 @@ exports.minify = function(files, options) {
|
|||
} else {
|
||||
if (typeof files == "string")
|
||||
files = [ files ];
|
||||
files.forEach(function(file){
|
||||
files.forEach(function(file, i){
|
||||
var code = options.fromString
|
||||
? file
|
||||
: fs.readFileSync(file, "utf8");
|
||||
sourcesContent[file] = code;
|
||||
toplevel = UglifyJS.parse(code, {
|
||||
filename: options.fromString ? "?" : file,
|
||||
filename: options.fromString ? i : file,
|
||||
toplevel: toplevel
|
||||
});
|
||||
});
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user