Pasha Immortals
Pasha Immortals

Reputation: 839

Need to combine JQuery files to save load time



I have the following JQuery libraries and I need to combine them in order to fasten up my web pages. Whats the best way and do some of them include the other ones in it, or can I find it some where, minified version that is.

JQuery.v1.6.4.js
jquery.tools.min.js
jquery-ui-1.8.16.custom.min.js
jquery.hoverIntent.minified.js
jquery.alphanumeric.pack.js
jquery.dcmegamenu.1.3.3.js
hero_image_slideshow.js

Thanks.

Upvotes: 2

Views: 3823

Answers (7)

Bart
Bart

Reputation: 505

Try out the online tools at jscompress.com it seems reasonably good.
You can either copy > paste your code in, or upload your js files and it will compress them for you.

Upvotes: 0

King Friday
King Friday

Reputation: 26076

  1. Combine and Minify JavaScript so that it is a smaller download and runs faster
  2. GZIP your JavaScript so it is a smaller download across the network
  3. Place your JavaScript on a CDN such as Akumai, Lime Light or Cloudfront

I do this for my ecommerce development business with very speedy results.

Upvotes: 1

kvc
kvc

Reputation: 1137

You can use httpcombiner if you are using asp.net. http://archive.msdn.microsoft.com/HttpCombiner Or else you can use yui compressor http://developer.yahoo.com/yui/compressor/ http://www.refresh-sf.com/

Upvotes: 4

user920041
user920041

Reputation:

You can use require.js and its optimizer: http://requirejs.org/docs/optimization.html

Upvotes: 2

tonyb
tonyb

Reputation: 116

Take a look at Google Closure Compiler.

http://code.google.com/closure/compiler/

Not only can you use it to concatenate the files for you, it will do other optimizations including minification, etc.

Upvotes: 2

Jan Pöschko
Jan Pöschko

Reputation: 5560

This is very related to a similar question about combining jscript files. A possible solution is compressJS, which uses the Google Closure Compiler in turn.

Upvotes: 1

David Hedlund
David Hedlund

Reputation: 129792

Is server-side combine an option? In that case, what are you running the site on? If you're using .NET, I highly recommend Combres.

For PHP sites, try minify.

Scott Hanselman blogged about a batch script for the same purpose using AjaxMin. You could include that as part of a build script, for instance, if you can't/don't want to combine the files at runtime.

One of the benefits of on-the-fly combining/minifying is that you can decide to turn it off for requests from your IP address, for instance, so that you will always be able to read the original script, if you're debugging live code.

Upvotes: 0

Related Questions