Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

unexpexted result with semicolons=false #515

Closed
jkalbhenn opened this issue Jul 14, 2014 · 3 comments
Closed

unexpexted result with semicolons=false #515

jkalbhenn opened this issue Jul 14, 2014 · 3 comments

Comments

@jkalbhenn
Copy link

using the git version 2.4.15 including the commits from Jul 09, 2014.
the documentation under "Beautifier options" states: "whenever possible we will use a newline instead of a semicolon", but when writing the following code to uglifyjs' standard-input:

file test.js:
var a = 1
var b = 2
var c = 3

using:
cat test.js |uglifyjs --beautify semicolons=false

the result is
var a = 1;

var b = 2;

var c = 3;

as far as i know semicolons are not necessary in this case, so considering the documentation, i would expect them to be left out.

as a side note: the documentation could be improved by explaining/hinting the --beautify options format either more generally or under "Beautifier options". it is only explained under compressor options, but if only interested in the beautifer options one does not look there.

@rvanvelzen
Copy link
Collaborator

--beatify also enables beautification, which overrides the semicolons setting.

If you pass --beautify "beautify=false,semicolons=false" you'll get the expected result.

This is indeed confusing, and a change in options to change output settings without automatically enabling beautification is planned.

@eremzeit
Copy link

eremzeit commented Mar 5, 2015

It was unintuitive to me that you had to quote the list of options.

These work:
uglifyjs --beautify beautify=false myfile.js
uglifyjs --beautify quote_style=1 myfile.js

But these don't work:
uglifyjs --beautify beautify=false --beautify quote_style=2 myfile.js
uglifyjs --beautify beautify=false quote_style=2 myfile.js

It might be worth throwing an example into the readme of how to pass multiple beautify options.

@abelnation
Copy link

separate your beautify options with a comma, e.g.

uglifyjs myfile.js --beautify='beautify=false,quote_style=2'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants