From: Alex Lam S.L Date: Fri, 24 Feb 2017 20:13:10 +0000 (+0800) Subject: update docs for `pure_funcs` & `drop_console` (#1503) X-Git-Url: https://git.ndcode.org/public/gitweb.cgi?a=commitdiff_plain;h=834f9f39245f1ddf5a29c579afd7ebcdb0afe585;p=UglifyJS.git update docs for `pure_funcs` & `drop_console` (#1503) closes #1362 closes #1399 --- diff --git a/README.md b/README.md index 1d0244ee..490f178c 100644 --- a/README.md +++ b/README.md @@ -87,10 +87,9 @@ The available options are: -b, --beautify Beautify output/specify output options. -m, --mangle Mangle names/pass mangler options. -r, --reserved Reserved names to exclude from mangling. - -c, --compress Enable compressor/pass compressor options. Pass - options like -c - hoist_vars=false,if_return=false. Use -c with - no argument to use the default compression + -c, --compress Enable compressor/pass compressor options, e.g. + `-c 'if_return=false,pure_funcs=["Math.pow","console.log"]'` + Use `-c` with no argument to enable default compression options. -d, --define Global definitions -e, --enclose Embed everything in a big function, with a @@ -151,8 +150,10 @@ The available options are: them explicitly on the command line. --mangle-regex Only mangle property names matching the regex --name-cache File to hold mangled names mappings - --pure-funcs List of functions that can be safely removed if - their return value is not used [array] + --pure-funcs Functions that can be safely removed if their + return value is not used, e.g. + `--pure-funcs Math.floor console.info` + (requires `--compress`) ``` Specify `--output` (`-o`) to declare the output file. Otherwise the output @@ -415,7 +416,9 @@ to set `true`; it's effectively a shortcut for `foo=true`). overhead (compression will be slower). - `drop_console` -- default `false`. Pass `true` to discard calls to - `console.*` functions. + `console.*` functions. If you wish to drop a specific function call + such as `console.info` and/or retain side effects from function arguments + after dropping the function call then use `pure_funcs` instead. - `keep_fargs` -- default `true`. Prevents the compressor from discarding unused function arguments. You need this