diff options
author | Mihai Bazon <mihai@bazon.net> | 2012-10-02 13:20:07 +0300 |
---|---|---|
committer | Mihai Bazon <mihai@bazon.net> | 2012-10-02 13:20:07 +0300 |
commit | dde5b22b5e99d4a75c8918659b7f73abed436ce2 (patch) | |
tree | b724402dab6a58618bcf418c0a6c1014db8a6afb /bin/uglifyjs2 | |
parent | e1098b04a7e8b3ebd4faf598b2b8b30bceba14d6 (diff) | |
download | tracifyjs-dde5b22b5e99d4a75c8918659b7f73abed436ce2.tar.gz tracifyjs-dde5b22b5e99d4a75c8918659b7f73abed436ce2.zip |
support defines
Diffstat (limited to 'bin/uglifyjs2')
-rwxr-xr-x | bin/uglifyjs2 | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/bin/uglifyjs2 b/bin/uglifyjs2 index ea82ddfb..63eba7cc 100755 --- a/bin/uglifyjs2 +++ b/bin/uglifyjs2 @@ -22,6 +22,7 @@ For example -p 3 will drop 3 directories from file names and ensure they are rel .describe("c", "Enable compressor/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("d", "Global definitions") .describe("stats", "Display operations run time on STDERR.") .describe("v", "Verbose") @@ -32,10 +33,12 @@ Use -c with no argument if you want to disable the squeezer entirely.") .alias("b", "beautify") .alias("m", "mangle") .alias("c", "compress") + .alias("d", "define") .string("b") .string("m") .string("c") + .string("d") .boolean("v") .boolean("stats") @@ -67,7 +70,7 @@ function getOptions(x) { var a = opt.split(/\s*[=:]\s*/); ret[a[0]] = a.length > 1 ? new Function("return(" + a[1] + ")")() : true; }); - normalize(ret) + normalize(ret); } return ret; } @@ -76,6 +79,10 @@ var COMPRESS = getOptions("c"); var MANGLE = getOptions("m"); var BEAUTIFY = getOptions("b"); +if (COMPRESS && ARGS.d) { + COMPRESS.global_defs = getOptions("d"); +} + var OUTPUT_OPTIONS = { beautify: BEAUTIFY ? true : false }; |