tags:

views:

80

answers:

7

A website I'm using on only uses a very small amount of jQuery, in the drop-down menu (I'm using the JSDDM drop-down menu). Is it possible to either manually or automatically make a cut-down version of jQuery which only contains the needed code?

A: 

I would simply use the packed version of jQuery http://jqueryjs.googlecode.com/files/jquery-1.3.2.min.js and then compress any additional plugins.

Tom
A: 

jQuery in itself you can't cut down on. If you use jQuery UI you can build your own dist (http://jqueryui.com/download).

Alternatively (to save load on your own servers) you can use jQuery from Google http://code.google.com/apis/ajaxlibs/

veggerby
A: 

Why do you need this? You can use minified jQuery version (19kb) or write your own JS not using jQuery.

Deniss Kozlovs
A: 

Use the minified version of the library. But you cannot really just remove the part of the library without breaking it.

RaYell
A: 

You could manually strip out what you don't need but I wouldn't envy you trying it, the minified version of jQuery is only 58kb in size tho.

Fermin
+2  A: 

I don't think it's a good idea to edit the code. Use the minified package instead.

mck89
A: 

Of course it is, jQuery is open source. The source code is here. If you can use only a subset, and probably combine it with your own JS file before minifying, it could be a way to go in terms of load time.

Note veggerby's reply about CDNs like Google Ajax API stuff; since the user will have it in cache if they've visited any other site using jQuery and loading it via Google. Cache is even faster than loading a cut-down version from your site. :-) And Google's CDN is pretty quick, too.

T.J. Crowder