Is it possible to extract a subset of jQuery?

Only a small amount of jQuery is used in the website used, in the drop-down menu (I use JSDDM drop-down ). Is it possible to manually or automatically create an abridged version of jQuery that contains only the necessary code?

+3
jquery
source share
8 answers

I don't think this is a good idea for editing code. Use the mini pack instead.

+1
source share

Yes it is possible. Just use jQuery Builder or a few smaller jQuery alternatives like Zepto , MinifiedJS, or $ dom .

+6
source share

jQuery itself cannot be trimmed. If you are using jQuery UI, you can create 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/

+1
source share

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

0
source share

Use the mini version of the library. But you cannot just delete part of the library without breaking it.

0
source share

You can manually cut what you don’t need, but I wouldn’t envy you if you tried it, the mini version of jQuery is only 58kb in size.

0
source share

Of course, jQuery is open source. The source code is here . If you can only use a subset and possibly combine it with your own JS file before minimizing it, this might be a way to transition in terms of load time.

Check out veggerby's answer on CDN, for example, the Ajax API; since the user will have it in the cache if they visited any other site using jQuery and downloading it through Google. The cache is even faster than downloading the cut version from your site. :-) And the Google CDN is also pretty fast.

0
source share

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

-one
source share

All Articles