开发者

how to compress more jquery file?

开发者 https://www.devze.com 2022-12-29 23:03 出处:网络
is there any way开发者_Go百科 to compress more jquery base file? what i have is about 56K and i need a more light file because of dial-up speed(56k).You can also check the The JavaScript CompressorRat

is there any way开发者_Go百科 to compress more jquery base file? what i have is about 56K and i need a more light file because of dial-up speed(56k).


You can also check the The JavaScript CompressorRater and see how different tools will compress jQuery. The rule of thumb however is to enable GZIP compression for browsers that support it.


jquery 1.4 compressed with JSMin is close to 56K. packer by dean edwards generally gives a little better compression but would take longer to decompress on client side. you can compare both at jscompress haven't seen jquery compressed with closure being used anywhere. Personally I'd go with JSMin and serve with gzip compression. That brings it down to ~23K


You can also use the ones hosted by Google, even uncompressed. The users probably have them loaded in their browser's cache, so they're not downloaded at all on your site.

http://code.google.com/apis/ajaxlibs/documentation/#jquery


You can use different minifiers to get slightly different results, and let the server use gzip to compress the files.

Google hosts the library, so you can use their server and hope that the users already have the file in the cache.

However, the download time of the library will still be at least three seconds over a 56k modem. It's not a light-weight library, if you use it you have to accept the extra load. Consider if you need it, or if plain Javascript would be a better solution.


http://www.google.ru/search?hl=ru&q=compress+javascript&btnG=%D0%9F%D0%BE%D0%B8%D1%81%D0%BA+%D0%B2+Google&lr=

There are a lot of technics to compress js-files. You should start with downloading the min-version of jquery files - http://code.jquery.com/jquery-1.4.2.min.js.

You can also think about reducing your websites size


Check if your server compresses Javascript files (e.g. with this tool).

0

精彩评论

暂无评论...
验证码 换一张
取 消