Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Best javascript compiler/minifier [closed]

I remember having seen a new javascript compiler/ minifier on github which should even be better than google's closure compiler. Unluckily I can't remember its name and find it again. Maybe someone can help me? :)

Thanks, Corin

like image 691
gucki Avatar asked Mar 18 '11 08:03

gucki


People also ask

Should you minify JavaScript?

Minifying strips out all comments, superfluous white space and shortens variable names. It thus reduces download time for your JavaScript files as they are (usually) a lot smaller in filesize. So, yes it does improve performance. The obfuscation shouldn't adversely affect performance.

How do you minify a JavaScript file?

To minify JavaScript, try UglifyJS. The Closure Compiler is also very effective. You can create a build process that uses these tools to minify and rename the development files and save them to a production directory.

Which of the following JavaScript compilers can both minify and optimize a JavaScript code?

Google Closure Compiler As accurately as you would expect, google has a javascript minifier too. The Google Closure Compiler is with over 4500 ⭐️on github is such a great tool; it is optimized for both efficiency and speed and there is constant support around it.


2 Answers

See the statistics src: http://axod.blogspot.ca/2010/01/google-closure-compiler-advanced-mode.html

compare JSMin, by Douglas Crockford and Yahoo! YUI

Minifier           | Bytes   |% of original| gz Bytes | gz % original None               | 428,264 |    100%     |   91,750 |     100% JSMin              | 249,372 |     58%     |   57,338 |     62% YUI                | 235,214 |     55%     |   55,990 |     61% Closure (STANDARD) | 219,446 |     51%     |   53,515 |     58% Closure (ADVANCED) | 166,774 |     39%     |   47,372 |     52% 

Closure takes the idea of a Javascript minifier a step further. It does this by doing real compilation to remove unused code, inlines variables and rewrites code to make it as small as possible.

Just for reference, you can access the Google Closure Compiler UI here http://closure-compiler.appspot.com/home

like image 35
Samuel Avatar answered Oct 08 '22 11:10

Samuel


Possibly UglifyJS? It's the minifier that the jQuery project is currently using.

Check out these speed comparisons.

like image 127
Bryan Downing Avatar answered Oct 08 '22 13:10

Bryan Downing