Closure compiler is one of my favourite javascript compressor tool. It can compress your large javascript and shrink the variables to minify your javascript size. But I had a problem (not a big problem really) closure compiler only work when you online. So now I want to share the offline version of closure compiler. It will compress your script in just one click.


First make sure you already installed java in your PC otherwise it won't work. Download the latest closure compiler then extract the zip file. You should see the main file, compile.jar.
Create a new *.bat file then paste this command to it.

java -jar compiler.jar --js hello.js --js_output_file hello-compiled.js

This *.bat file will work as a shortcut so you don't have to go to cmd then type that command anymore.
Next, put the source javascript file at the same folder and rename it to hello.js. After that, click that bat file then if no error, the file hello-compiled.js will appear. That is your compressed javascript.
Easy to use right? :D
hi folks, visit my other tutorial blog at Kumpulan tutorial menarik
0 comments