Subscribe to RSS Subscribe to Comments

Alan Blaine Whitney

JQuery and Speed

I use jquery a fair amount.  Overall I am very pleased.   I use the full effects and ui suite.  Both UI and JQuery offer a minified version of their libraries.  Which is great, but sometimes I like to have the source to look at, so I often download the developer versions of this libraries.  So to use them, I would have to use the non-minified versions and would have to make many more http requests then needed and now on top of that, include any of my own javascript code.

This could make things very slow.  To work around this, I wrote a bash script, that is executable in Linux and uses the wonderfully simply jsmin program.  I place all of the files that comes with jquery ui (along with thickbox) in the /js/ folder along with this bash script.

#!/bin/bash

gcc -o jsmin ./jsmin.c

cat jquery-1.2.6.js | ./jsmin > main.js

cat effects.core.js | ./jsmin >> main.js

cat effects.blind.js | ./jsmin >> main.js
cat effects.bounce.js | ./jsmin >> main.js
cat effects.clip.js | ./jsmin >> main.js
cat effects.drop.js | ./jsmin >> main.js
cat effects.explode.js | ./jsmin >> main.js
cat effects.fold.js | ./jsmin >> main.js
cat effects.highlight.js | ./jsmin >> main.js
cat effects.pulsate.js | ./jsmin >> main.js
cat effects.scale.js | ./jsmin >> main.js
cat effects.shake.js | ./jsmin >> main.js
cat effects.slide.js | ./jsmin >> main.js
cat effects.transfer.js | ./jsmin >> main.js

cat ui.core.js | ./jsmin >> main.js

cat ui.accordion.js | ./jsmin >> main.js
cat ui.datepicker.js | ./jsmin >> main.js
cat ui.dialog.js | ./jsmin >> main.js
cat ui.draggable.js | ./jsmin >> main.js
cat ui.droppable.js | ./jsmin >> main.js
cat ui.resizable.js | ./jsmin >> main.js
cat ui.selectable.js | ./jsmin >> main.js
cat ui.slider.js | ./jsmin >> main.js
cat ui.sortable.js | ./jsmin >> main.js
cat ui.tabs.js | ./jsmin >> main.js

cat thickbox.js | ./jsmin >> main.js

cat page.js | ./jsmin >> main.js

The file page.js is my javascript source. Sometimes I add additional files as well.  Here is a download-able demo of this.

Some other speedy libraries that I enjoy to use are CSSTidy and OptiPNG

Comments

  1. March 7th, 2009 | 9:17 am

    [...] – JQuery and Speed saved by wolfmetal9112009-02-23 – Introducing FireStarter WordPress Theme saved by pjjw2009-02-21 – [...]

Leave a reply

Based on FluidityTheme Redesigned by Kaushal Sheth Sponsored by Send Flowers