diff options
author | Damian Krzeminski <pirxpilot@code42day.com> | 2015-10-13 21:05:37 -0400 |
---|---|---|
committer | Damian Krzeminski <pirxpilot@code42day.com> | 2015-10-13 21:24:14 -0400 |
commit | d5138f74677012b301636cad6d218486e53265e2 (patch) | |
tree | 82e186881ce032e46fa7841282773744cb79c2a8 /bin | |
parent | eac67b281644d4363deebf5dd3d2a1322e3b2319 (diff) | |
download | tracifyjs-d5138f74677012b301636cad6d218486e53265e2.tar.gz tracifyjs-d5138f74677012b301636cad6d218486e53265e2.zip |
add `--pure-funcs` option
it has the same effect as specifying `pure_funcs` in `--compressor`
option, however it's much easier to use
instead of:
--compressor 'pure_func=["Math.floor","debug","console.logTime"]'
it's now possible:
--compressor --pure-funcs Math.floor debug console.logTime
fixes #684
Diffstat (limited to 'bin')
-rwxr-xr-x | bin/uglifyjs | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/bin/uglifyjs b/bin/uglifyjs index f82d43cb..ca75f159 100755 --- a/bin/uglifyjs +++ b/bin/uglifyjs @@ -72,6 +72,7 @@ You need to pass an argument to this option to specify the name that your module .describe("mangle-props", "Mangle property names") .describe("mangle-regex", "Only mangle property names matching the regex") .describe("name-cache", "File to hold mangled names mappings") + .describe("pure-funcs", "List of functions that can be safely removed if their return value is not used") .alias("p", "prefix") .alias("o", "output") @@ -104,6 +105,7 @@ You need to pass an argument to this option to specify the name that your module .string("prefix") .string("name-cache") .array("reserved-file") + .array("pure-funcs") .boolean("expr") .boolean("source-map-include-sources") @@ -175,6 +177,10 @@ if (ARGS.d) { if (COMPRESS) COMPRESS.global_defs = getOptions("d"); } +if (ARGS.pure_funcs) { + if (COMPRESS) COMPRESS.pure_funcs = ARGS.pure_funcs; +} + if (ARGS.r) { if (MANGLE) MANGLE.except = ARGS.r.replace(/^\s+|\s+$/g).split(/\s*,+\s*/); } |