2 min read
Prototype.js + Scriptaculous in one file under 50Kb!
I don't like the fat coders leave in their JavaScript, so I've packed Prototype.js and Scriptaculous into one single file under 50Kb.
OK. Call me anal or something but I don't like the way coders so frequently leave "fat" in their javascript. Which might be fine if everyone was on a T1 line or something, but they're not and we need to be nice and thoughtful and stuff.
To that end, I've gone to the trouble of playing with the Scriptaculous JS library and Prototype.js (which comes bundled with it) and I've managed to pack the whole lot into one single Javascript file, weighing in at just under 50Kb.
So now you can link to just one single JS file, wherever you want the full DHTML/AJAX power of Scriptaculous.
In case you're wondering, Prototype.js weighs in at 47Kb and the main Scriptaculous files total 91Kb. That's a total of 138Kb shrunk down to 49Kb or a drop down to 35.5% of the original size!
Note: the only Scriptaculous file I omitted was the unit testing one. It's not a core file anyway. Plus it would have blown the size out and I really wanted to keep under 50Kb... which does have a lovely ring to it.
Download the file here (right-mouse-click and save to disk): scriptaculous.shrunk.js
USAGE: Because I'm using the extended ASCII character set to push the compression a little hard to get it all in under 50Kb, you need to tell the client you're using that character set. This just means adding the charset attribute correctly to the HTML head of your pages (the first line is to keep IE happy):
<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1" />
<script src="wherever/scriptaculous.shrunk.js" type="text/javascript" charset="ISO-8859-1"></script>
Hope you enjoy it!
Oh, and a big hat-tip to Dean Edwards for the "Packer" magic.
Javascript, Ajax, Web, Design, prototype.js, script.aculo.us, Development


