diff options
author | Mihai Bazon <mihai@bazon.net> | 2012-09-03 10:14:15 +0300 |
---|---|---|
committer | Mihai Bazon <mihai@bazon.net> | 2012-09-03 10:14:15 +0300 |
commit | 596af60587a9badd43846aede9936e68868e61b2 (patch) | |
tree | 860a0939335f3fe65da630281eb8d63efdbdcfa2 /bin/uglifyjs2 | |
parent | f2f370cee3708c0d9431594f81e192099fc6900c (diff) | |
download | tracifyjs-596af60587a9badd43846aede9936e68868e61b2.tar.gz tracifyjs-596af60587a9badd43846aede9936e68868e61b2.zip |
add -b
Diffstat (limited to 'bin/uglifyjs2')
-rwxr-xr-x | bin/uglifyjs2 | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/bin/uglifyjs2 b/bin/uglifyjs2 index d7f2657b..279d4942 100755 --- a/bin/uglifyjs2 +++ b/bin/uglifyjs2 @@ -6,15 +6,22 @@ var sys = require("util"); var optimist = require("optimist"); var fs = require("fs"); var ARGS = optimist - .usage("uglifyjs2 [options] input1.js input2.js ...") + .usage("uglifyjs2 [options] input1.js input2.js ...\n\ +(maximum compression settings are on by default)\ +") .describe("source-map", "Specify an output file where to generate source map") .describe("source-map-root", "The root of the original source to be included in the source map") .describe("p", "Skip prefix for original filenames that appear in source maps") - .alias("p", "prefix") .describe("o", "Output file (default STDOUT)") - .alias("o", "output") .describe("stats", "Display operations run time on STDERR") .describe("v", "Verbose") + .describe("b", "Beautify output") + + .alias("p", "prefix") + .alias("o", "output") + .alias("v", "verbose") + .alias("b", "beautify") + .argv ; @@ -54,14 +61,17 @@ var SOURCE_MAP = ARGS.source_map ? UglifyJS.SourceMap({ }) : null; var output = UglifyJS.OutputStream({ - beautify: false, + beautify: ARGS.b, source_map: SOURCE_MAP }); files.forEach(do_file); +output = output.get(); + if (SOURCE_MAP) { fs.writeFileSync(ARGS.source_map, SOURCE_MAP, "utf8"); + output += "\n//@ sourceMappingURL=" + ARGS.source_map; } if (OUTPUT_FILE) { @@ -101,7 +111,7 @@ function do_file(file) { ast.mangle_names(); }); time_it("squeeze", function(){ - var compressor = UglifyJS.Compressor(); + var compressor = UglifyJS.Compressor({}); ast = ast.squeeze(compressor); }); time_it("generate", function(){ |