Allow passing arbitrary output options into minify

I find myself wanting to set various output options (beautify, indent_level, and comments, specifically), and it would be nice to not have to duplicate the entire minify() function in my code.
This commit is contained in:
Jimb Esser 2012-11-27 11:19:35 -08:00
parent 13c4dfcabd
commit bc3eca50cc

View File

@ -95,7 +95,11 @@ exports.minify = function(files, options) {
orig: inMap,
root: options.sourceRoot
});
var stream = UglifyJS.OutputStream({ source_map: map });
var output_options = {
source_map: map
};
UglifyJS.merge(output_options, options.output_options);
var stream = UglifyJS.OutputStream(output_options);
toplevel.print(stream);
return {
code : stream + "",