--beautify— output indented code; when passed, additional options control the beautifier:
--indent N— indentation level (number of spaces)
--quote-keys— quote keys in literal objects (by default, only keys that cannot be identifier names will be quotes).
--no-mangle— don't mangle variable names
--no-squeeze— don't call
ast_squeeze()(which does various optimizations that result in smaller, less readable code).
--mangle-toplevel— mangle names in the toplevel scope too (by default we don't do this).
ast_squeeze()is called (thus, unless you pass
--no-squeeze) it will reduce consecutive statements in blocks into a sequence. For example, "a = 10; b = 20; foo();" will be written as "a=10,b=20,foo();". In various occasions, this allows us to discard the block brackets (since the block becomes a single statement). This is ON by default because it seems safe and saves a few hundred bytes on some libs that I tested it on, but pass
--no-seqsto disable it.
--no-dead-code— by default, UglifyJS will remove code that is obviously unreachable (code that follows a
continuestatement and is not a function/variable declaration). Pass this option to disable this optimization.
--no-copyright— by default,
uglifyjswill keep the initial comment tokens in the generated code (assumed to be copyright information etc.). If you pass this it will discard it.
--output filename— put the result in
filename. If this isn't given, the result goes to standard output (or see next one).
--overwrite— if the code is read from a file (not from STDIN) and you pass
--overwritethen the output will be written in the same file.
--verbose— output some notes on STDERR (for now just how long each operation takes).
--extra— enable additional optimizations that have not yet been extensively tested. These might, or might not, break your code. If you find a bug using this option, please report a test case.
--unsafe— enable other additional optimizations that are known to be unsafe in some contrived situations, but could still be generally useful. For now only this:
--max-line-len(default 32K characters) — add a newline after around 32K characters. I've seen both FF and Chrome croak when all the code was on a single line of around 670K. Pass –max-line-len 0 to disable this safety feature.