What is the process of compressing javascript?

308    Asked by Namberumandubey in Java , Asked on Oct 12, 2022

I know that there are ways to dynamically load it into the page, but if I want to compress my code so it loads even faster, how do I do it?

Answered by Natalie Downing

I highly recommend Google Closure Compiler for compressing JavaScript code. I use it personally, and it is also the official compressor used by the jQuery project.


This project can do quite a lot, but the basics are this:

java -jar closure.jar -js javascriptFile.js > javascriptFile.min.js



Your Answer

Interviews

Parent Categories