Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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: stackoverflow.com/questions/841253/… –  Zoredache Jun 6 '11 at 22:32

2 Answers 2

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

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.