Jquery.com shows Minified and Gzipped version as 19KB?
Production (19KB, Minified and Gzipped)
Development (120KB, Uncompressed Code)
but when we click on download for Production version. it goes to this link
http://code.google.c开发者_运维问答om/p/jqueryjs/downloads/detail?name=jquery-1.3.2.min.js&downloadBtn=
and the file which is on this page it's size is 55.9 KB. Why jquery.com showing Production (19KB, Minified and Gzipped)
The file's unzipped size is 55.9 kB. That is the result of the minification, which is a shortening of variable names, stripping of white space and the likes.
When you gzip it additionally, it will lose even more size. The gzipped file is downloaded by the browser and unzipped into the 55.9 kB large, minified version internally so it can be read by the JS interpreter.
You can zip files using gzip but usually, if the server is set up correctly, the server will automatically serve gzipped files if the browser signals it can handle them. In that case you don't have to do anything. You can see whether a file was transmitted gzipped using the "view size information" tab in the Web Developer Toolbar for Firefox.
How to get 19KB Minified version of jquery file?
% wget http://jqueryjs.googlecode.com/files/jquery-1.3.2.min.js
% gzip jquery-1.3.2.min.js
% du -b jquery-1.3.2.min.js.gz
19716 jquery-1.3.2.min.js.gz
Download this JQuery minified version. Then ensure that your webserver is gzipping output. You need to ensure mod_deflate is enabled and then place the following (similar) setting in your .htaccess file:
# compress all text & html:
AddOutputFilterByType DEFLATE text/html text/plain text/xml application/x-javascript application/javascript text/css .php
# Or, compress certain file types by extension:
<Files *.html>
SetOutputFilter DEFLATE
</Files>
That will ensure your files are gzipped to the browser. You can use the webdeveloper toolbar to check the sizes.
To do this in IIS then follow this tutorial
精彩评论