aboutsummaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
authorMihai Bazon <mihai.bazon@gmail.com>2015-01-27 22:26:27 +0200
committerMihai Bazon <mihai.bazon@gmail.com>2015-01-27 22:26:27 +0200
commitfbbaa42ee55a7f753f7cab9b1a905ccf73cf26d5 (patch)
tree6db252b7cc4acb1835b6bf9644890a6f275cbf91 /bin
parent099992ecae5ed51332f3928b9e1c06e7ad8147b8 (diff)
downloadtracifyjs-fbbaa42ee55a7f753f7cab9b1a905ccf73cf26d5.tar.gz
tracifyjs-fbbaa42ee55a7f753f7cab9b1a905ccf73cf26d5.zip
Add option to preserve/enforce string quote style
`-q 0` (default) use single or double quotes such as to minimize the number of bytes (prefers double quotes when both will do); this is the previous behavior. `-q 1` -- always use single quotes `-q 2` -- always use double quotes `-q 3` or just `-q` -- always use the original quotes. Related codegen option: `quote_style`. Close #495 Close #460 Some `yargs` guru please tell me why `uglifyjs --help` doesn't display the help string for `-q` / `--quotes`, and why it doesn't output the expected argument types anymore, like good old `optimist` did.
Diffstat (limited to 'bin')
-rwxr-xr-xbin/uglifyjs11
1 files changed, 9 insertions, 2 deletions
diff --git a/bin/uglifyjs b/bin/uglifyjs
index 11c3a01a..c9f4c12d 100755
--- a/bin/uglifyjs
+++ b/bin/uglifyjs
@@ -66,6 +66,7 @@ You need to pass an argument to this option to specify the name that your module
.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.")
+ .describe("quotes", "Quote style (0 - auto, 1 - single, 2 - double, 3 - original)")
.alias("p", "prefix")
.alias("o", "output")
@@ -77,6 +78,7 @@ You need to pass an argument to this option to specify the name that your module
.alias("r", "reserved")
.alias("V", "version")
.alias("e", "enclose")
+ .alias("q", "quotes")
.string("source-map")
.string("source-map-root")
@@ -151,9 +153,14 @@ if (ARGS.r) {
if (MANGLE) MANGLE.except = ARGS.r.replace(/^\s+|\s+$/g).split(/\s*,+\s*/);
}
+if (ARGS.quotes === true) {
+ ARGS.quotes = 3;
+}
+
var OUTPUT_OPTIONS = {
- beautify: BEAUTIFY ? true : false,
- preamble: ARGS.preamble || null,
+ beautify : BEAUTIFY ? true : false,
+ preamble : ARGS.preamble || null,
+ quote_style : ARGS.quotes != null ? ARGS.quotes : 0
};
if (ARGS.screw_ie8) {