Can we split jquery.js in two parts?
Is it possible to开发者_开发百科 split jquery.js in two or three different part?
Currently I am using version 1.4.2, which is too heavy to load in 256kbps internet line.
Regards,
Vikas Parab
Look at jQuery's repository at GitHub, and at the Makefile there. You can adapt the build file (or Rakefile or Ant's build.xml) to only include the parts that you need.
switch to a CDN hosted jQuery source to maximize the cache hit on the browser and link the min.js version in your pages (Just 24.1 kb)
http://softwareas.com/google-jquery-cdn
Paul Irish states that you can effectively trim out all the parts that you don't think you'll ever need and suggests a way to do it here: http://paulirish.com/2010/10-things-i-learned-from-the-jquery-source/. Unfortunately, I can't seem to skip around the video, but you should watch the whole thing anyway--Paul is one of the jQuery masters!
This should help considerably if you're not using a lot of the library.
I hope this helps!
UPDATE: there's also a YouTube version which is more random-accessy. http://www.youtube.com/watch?v=i_qE1iAmjFg If you're impatient, skip to the 50m mark.
ALSO, I presume you ARE using the minified version? If not, that is considerably smaller.
UPDATE 2: If you're only using the selector portions of jQuery, consider using Sizzle (http://sizzlejs.com/), which is part of jQuery anyway. (Sizzle is only like 4K minified)
精彩评论