Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

When a JavaScript file is sent over an HTTP connection, the entire file is sent, and then the preprocessor on the clientside will deal with the rest?

Therefore, would removing comments and whitespace in a .js file optimize a js file for transfer?

share|improve this question
See:… – Zoredache Jun 6 '11 at 22:32
up vote 1 down vote accepted

I use Google Closure, gzip, and header cache tags to optimize my js transfer.

share|improve this answer

If you are working on a large project you can modularize your javscript code and load asynchronously using requirejs. This way you don't have to load the complete library code.

share|improve this answer

You may use Closure Compiler which is a minimization tool used to compress JS code even further than existing minimization tools.

For further details, you may visit

share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .