Merge pull request #736 from AlbertoGP/master

fromString option, use index from argument array for filename instead of "?"
This commit is contained in:
Richard van Velzen
2015-08-07 14:12:41 +02:00

View File

@@ -73,13 +73,13 @@ exports.minify = function(files, options) {
} else { } else {
if (typeof files == "string") if (typeof files == "string")
files = [ files ]; files = [ files ];
files.forEach(function(file){ files.forEach(function(file, i){
var code = options.fromString var code = options.fromString
? file ? file
: fs.readFileSync(file, "utf8"); : fs.readFileSync(file, "utf8");
sourcesContent[file] = code; sourcesContent[file] = code;
toplevel = UglifyJS.parse(code, { toplevel = UglifyJS.parse(code, {
filename: options.fromString ? "?" : file, filename: options.fromString ? i : file,
toplevel: toplevel toplevel: toplevel
}); });
}); });