Webmasters Stack Exchange is a question and answer site for pro webmasters. 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

I have a series of web pages that link to the following:


Not every page uses each .js (for example, not every pages uses jquery.ui.button) however I was wondering if it would make more sense to combine all of these files and minify them into a single.js file and include it on every page?

share|improve this question
Probably will if you expect people to go to a lot of the pages. Browser caching should make it worthwhile. What kind of users are you serving? – Jethro Larson Dec 1 '11 at 19:20
Hmm I don't know...do you mean by browser? Seems mainly to be IE7 and Chrome. – redconservatory Dec 1 '11 at 19:45
I don't have a lot of experience minifying...do I just take all the pages, combine it into one page, and run it through a minifier? – redconservatory Dec 1 '11 at 19:45

Yes, you should combine the files.
Just use the custom download builder to select the parts you need, and it'll do it for you.

share|improve this answer

You should combine and minify these.

As per your comment to your question, there are tools that can help with this but essentially yeah, putting them all into one file and running a minifier will do the job.

share|improve this answer

One thing to consider is that total download size is not the only factor that will determine how long it takes to load a page. Each additional, external .js file is a separate server request for download, so load times will be impacted beyond the simple size of the file.

Google Page Speed has an excellent segment on how combining (or not) external files can impact page load time, using the concept of 'Round Trip Time.' Even beyond round trip, some older browsers do not allow parallel file downloading, and will block additional content from loading until all scripts are downloaded and executed.

Hope this helps!

share|improve this answer

I like the Google Closure Compiler ( http://code.google.com/closure/compiler/ ) for combining and minifying javascript files.

I don't use any advanced features.

share|improve this answer

You can also link to the jQuery files on http://cdnjs.com/ which is a free CDN hosting the most common jQuery and plugin js files.

share|improve this answer

Your Answer


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.