diff options
author | Mihai Bazon <mihai@bazon.net> | 2015-01-05 11:03:13 +0200 |
---|---|---|
committer | Mihai Bazon <mihai@bazon.net> | 2015-01-05 11:03:13 +0200 |
commit | e1f0747e4cca7b77a0189dacbff9fa4800a2835c (patch) | |
tree | 013bd242a4107d3cd9046e8038823637c7a1d9e7 /bin | |
parent | e37b67d013c4537a36bb3c24f4f99e72efbf6d4b (diff) | |
download | tracifyjs-e1f0747e4cca7b77a0189dacbff9fa4800a2835c.tar.gz tracifyjs-e1f0747e4cca7b77a0189dacbff9fa4800a2835c.zip |
Support keep_fnames in compressor, and --keep-fnames. #552
Passing `--keep-fnames` will enable it both for compressor/mangler, so that
function names will not be dropped (when unused) nor mangled.
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 a177cb6f..44afd2f4 100755 --- a/bin/uglifyjs +++ b/bin/uglifyjs @@ -65,6 +65,7 @@ You need to pass an argument to this option to specify the name that your module .describe("V", "Print version number and exit.") .describe("noerr", "Don't throw an error for unknown options in -c, -b or -m.") .describe("bare-returns", "Allow return outside of functions. Useful when minifying CommonJS modules.") + .describe("keep-fnames", "Do not mangle/drop function names. Useful for code relying on Function.prototype.name.") .alias("p", "prefix") .alias("o", "output") @@ -160,6 +161,11 @@ if (ARGS.screw_ie8) { OUTPUT_OPTIONS.screw_ie8 = true; } +if (ARGS.keep_fnames) { + if (COMPRESS) COMPRESS.keep_fnames = true; + if (MANGLE) MANGLE.keep_fnames = true; +} + if (BEAUTIFY) UglifyJS.merge(OUTPUT_OPTIONS, BEAUTIFY); |