PageSpeed : Minify Javascript
Published by Aslam
Compacting JavaScript code can save many bytes of data and speed up downloading, parsing, and execution time.
Minifying JavaScript means removing unnecessary bytes such as spaces, comments, line-breaks, and indentation in your JavaScript code.
It will reduce the total size of the JavaScript file.
If you are inlining your JavaScript files inside html, compressing it will help reduce the total size of the page thus the browser download it quick than before.
and if you are using external javascript files, it can be loaded,parsed,and executed faster than before.
How to minify JavaScript
There are several tools available to minify JavaScript.
"Closure Compiler" from Google is the better option to minify JavaScript.
http://closure-compiler.appspot.com
I prefer the online tool at www.blimptontech.com. The main reasons I like it are, it is regularly updated where many online tools are not, it uses UglyfyJS2 for the minification library which also gives you concatenation of your variables. You can also combine as many JS files as you want into a single one and minify at the same time. I also read that it is going to be adding more tools to it as well.
ReplyDelete