-
Notifications
You must be signed in to change notification settings - Fork 14
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
Remove the nasty spaces left by closure compiler #24
Comments
My 2 cents: As for me, every tool should stick to UNIX-way: “Do One Thing and Do It Well”. What if one needs that whitespace for some obscure reason? Say, |
Sure, spaces can be useful in some crazy experiments, but for regular compression, they are annoying, especially when they come from closure compiler for no apparent reason |
This is clearly a workaround for a bug from another tool. If you are really concerned with size (such as for js1k), I would recommend hand minification over Closure Compiler, although the latter could be a good starting point. I was considering the possibility to add a minification stage first, with a different workflow in mind : when hand minifying, I try to keep the code as readable as one can do (comment, spaces, indents. See the "human readable" code from my js1k entry Voyager ), then run it through minification (not CC) then RegPack before submitting. Adding an optional minification stage would make the workflow simpler. It would also solve your issue by removing the unnecessary spaces added by CC. |
I know this is and old issue but, I was looking at closure compiler docs the other day and stumbled over an FAQ that explains why the whitespace is there:
|
Hello,
Google closure compiler has a "bug" (I guess) where it randomly inserts spaces in the minified code it outputs. Exemple with my last js1k entry:
google CC output:
this code contains 3 unnecessary spaces:
, q=256
,; for(i=f.length
,a.width/ 2
I submitted an issue to google CC about that but they don't seem to care.
But maybe you can do the fix in regpack!
I'd love to see RegPack automatically remove obvious unnecessary spaces (before or after a comma, slash, semicolon, etc.)
It would save bytes, and it would save a lot of valuable time for the people trying to remove those spaces by hand everytime they pack their code.
cheers!
cc.@subzey
PS: I know, there are other JS minifiers than CC, but it's generally the best one and the most used. That's why I ask :)
The text was updated successfully, but these errors were encountered: