Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

55KB of JQUERY is too big for my application

Is there any way to truncate jQuery?

I need to use only AJAX related methods in jQuery code.

As you might know the minified version is only 55KB and the uncompressed version is about 110KB.

like image 477
David Bonnici Avatar asked Apr 08 '09 13:04

David Bonnici


2 Answers

I think the answer to your question is 'probably not'.

But consider these points:

  • You don't have to serve it on every page request, sensible HTTP response headers should mean it only needs to be downloaded once per client browser.
  • If you use the Google CDN for jQuery, your client may not need to download it at all, as there is a very good chance they will already have it cached.

i.e.

<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.1/jquery.min.js"></script>
like image 161
DanSingerman Avatar answered Sep 26 '22 00:09

DanSingerman


Using gzip compression it brings it down to 19kb. It's going to be cached from there on out, so I'm not sure why it's an issue. That's far less than most decent sized images.

Using a CDN is also an option if you don't mind someone else hosting your code and your issue is just overall bandwidth.

like image 21
cgp Avatar answered Sep 24 '22 00:09

cgp