This is a small post made in hopes it reaches a JavaScriptdeveloper, who in turn passes it along to another, then another, so-on-and-so-forth…
I use jQuery with nearly every project. While I find it easier and easier to roll my own JavaScript, I’m not one for reinventing the wheel. If a plug-in exists that does what I want, I’ll use it. The first thing I do is check if they have a packed version (size matters). If not, I pack my own. My problems start when developers don’t have a packed version already available. Chances are, if they don’t have a packed version available, it’s because the JavaScript packer breaks their code. Not because it’s bad code, and not because there is something wrong with Dean Edwards packer, but because when code is packed certain operations are changed if the code isn’t written perfectly.
Enter JSLint. Think of JSLint as the W3C Validator for JavaScript. If your code passes inspection (you can essentially ignore repeatedly assigned vars), it will pack.
Tonight I’ve had to fix not one, but two jQuery plug-ins to make them available for packing. The first is the preloadCssImages plug-in from the filament group (amazing developers I might add) and the second is FancyBox by some guy called KAC. I’m not calling anyone out, rather hoping to make people aware of JSLint. It only takes a few moments to go through your code, and the result is a much lighter footprint in most cases.
I’ve contacted the creators of their respective plug-ins, but if they don’t post the fixed, here they are:
preloadCssImages
FancyBox
I’ll have another post in the next 24 hours releasing a free wordpress theme, so stay tuned!
Hmm, interesting stuff. I’m trying to get started in Javascript, but I’m finding it hard to wrap my head around the way it works.