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
Post a Comment