aboutsummaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
authorMihai Bazon <mihai@bazon.net>2012-09-19 10:22:36 +0300
committerMihai Bazon <mihai@bazon.net>2012-09-19 10:22:36 +0300
commitd53e1a9931d29c875d2bb23e50a2d2f535b01890 (patch)
tree81e4b8044e0e6a777efc89631a2b4152febd1913 /bin
parenta4d2340c7325ff864d2ca3937d8556eb4cbd7437 (diff)
downloadtracifyjs-d53e1a9931d29c875d2bb23e50a2d2f535b01890.tar.gz
tracifyjs-d53e1a9931d29c875d2bb23e50a2d2f535b01890.zip
support -c with no arguments to disable compression entirely
Diffstat (limited to 'bin')
-rwxr-xr-xbin/uglifyjs229
1 files changed, 18 insertions, 11 deletions
diff --git a/bin/uglifyjs2 b/bin/uglifyjs2
index e753631c..e79f71c8 100755
--- a/bin/uglifyjs2
+++ b/bin/uglifyjs2
@@ -10,15 +10,18 @@ var ARGS = optimist
Maximum compression settings are on by default.\n\
Use a single dash to read input from the standard input.\
")
- .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")
+ .describe("source-map", "Specify an output file where to generate source map.")
+ .describe("source-map-root", "The path to the original source to be included in the source map.")
+ .describe("p", "Skip prefix for original filenames that appear in source maps. For example -p 3 will drop 3 directories from file names and ensure they are relative paths.")
.describe("o", "Output file (default STDOUT)")
- .describe("stats", "Display operations run time on STDERR")
- .describe("v", "Verbose")
.describe("b", "Beautify output")
.describe("m", "Don't mangle names")
- .describe("c", "Pass compressor options")
+ .describe("c", "Disable compressor, or pass compressor options. \
+Pass options like -c hoist_vars=false,if_return=false. \
+Use -c with no argument if you want to disable the squeezer entirely")
+
+ .describe("stats", "Display operations run time on STDERR")
+ .describe("v", "Verbose")
.alias("p", "prefix")
.alias("o", "output")
@@ -33,6 +36,8 @@ Use a single dash to read input from the standard input.\
.boolean("m")
.string("c")
+ .wrap(80)
+
.argv
;
@@ -50,7 +55,7 @@ if (ARGS.h || ARGS.help) {
}
var COMPRESSOR_OPTIONS = {};
-if (ARGS.c) {
+if (ARGS.c && ARGS.c !== true) {
ARGS.c.replace(/^\s+|\s+$/g).split(/\s*,+\s*/).forEach(function(opt){
var a = opt.split(/\s*=\s*/);
COMPRESSOR_OPTIONS[a[0]] = new Function("return(" + a[1] + ")")();
@@ -134,10 +139,12 @@ function do_file_1(file) {
time_it("scope", function(){
ast.figure_out_scope();
});
- time_it("squeeze", function(){
- var compressor = UglifyJS.Compressor(COMPRESSOR_OPTIONS);
- ast = ast.squeeze(compressor);
- });
+ if (ARGS.c !== true) {
+ time_it("squeeze", function(){
+ var compressor = UglifyJS.Compressor(COMPRESSOR_OPTIONS);
+ ast = ast.squeeze(compressor);
+ });
+ }
ast.filename = file;
return ast;
}