views:

231

answers:

3

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.com/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)

+11  A: 

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.

Pekka
i'm using jquery on asp.net site how can i gzipped to compress
metal-gear-solid
Check my edited answer.
Pekka
file is already unzipped http://jqueryjs.googlecode.com/files/jquery-1.3.2.min.js it's in .js format not in .zip format
metal-gear-solid
u mean i can compress file to get in 19 KB size using gzip.org and it will work same like unzipped version
metal-gear-solid
Yes but you won't need to. Make sure your server serves the content gzipped.
Pekka
how can i check server is capable or not to server gzipped content? my site is asp.net based
metal-gear-solid
It depends on your server, not site. Check the request headers using a proxy (like Charles) and see if the Accept-Encoding header contains gzip or deflate (which is a similar compression)
Ariel
is there already gzipped 19 kb .js file somewhere else?
metal-gear-solid
Jitendra: Check the last paragraph of my answer, with the Toolbar you can find out whether your server serves minified stuff or not.
Pekka
I've checked my server info saying "Content-Encoding: gzip"
metal-gear-solid
If you want to make sure your jquery is delivered zipped, I would still make sure using the WDT or Firebug. Content enconding could be on for certain filetypes only.
Pekka
how can i check if i add jquery gzipped version to my asp.net website then my IIS server will serve as a gzipped or not ? I work in a company i can't edit anything in server. but how to know it will support or not. and if it's not possible to know or if my server doesn't support, what are other methods to compress jquery file to maximum possible level?
metal-gear-solid
Web Developer Toolbar > Information > View Document Sizeshowing - jquery.js 22 KB (56 KB uncompressed)
metal-gear-solid
Then it's serving it gzipped already, all is fine.
Pekka
it means if i add minified 55 kb version , my server will automatically gzipped
metal-gear-solid
i just need to add minified version in header of my site. ok. but if i use goole link in place of my hosted juery file then my server will gzipped google version or not
metal-gear-solid
+2  A: 

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

Shadi Almosri
and how in IIS?
metal-gear-solid
i've updated it with IIS info
Shadi Almosri
+3  A: 

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
S.Mark