Tag Archives: minify

The Google Closure Minifier App CodeUnit 23 NOV 2010

I’ve mentioned Google’s cool Closure javascript minifier project here in these pages before, but now I seen they’ve gone and put up a fantastic app that makes it as simple as a snap of the fingers to generate your own minified versions of your existing javascript js libraries.

To use is as simple as hitting the URL, adding a URL to the js library you want to minify, selecting the optimization type you want to employ, add some additional formatting rules and compile!

Simple, nice, and gives a great result, telling you by how much the new file was compressed, giving you various other stats, showing off the compiled code, warning, errors (and even POST data) and most important of all, providing a download link to your minified js file.

Seriously cool in other words! :)

Related Link: http://closure-compiler.appspot.com/home

Optimize Your Javascript by Minifying with Google’s Closure Compiler CodeUnit 02 MAR 2010

Optimize your Javascript by minifying with Google’s Closure Compiler. Well, that pretty much says it all. By now we all no that there is plenty of scope for reducing the size of one’s Javascript code by replacing bulky variable names with shorter versions and stripping out whitespace, etc., but naturally as one would expect, achieving this optimization by hand is a rather tiresome affair.

Enter the nifty Google Closure Compiler, simply put, a tool for making Javascript download and run faster. It’s not a traditional code compiler mind you, it doesn’t compile source code into machine code but rather compiles Javascript to better Javascript, analyzing, clearing dead code, and rewriting and minimizing what’s left over. It checks syntax, variable references, types and even warns about common javascript pitfalls just for fun.

There are a number ways in which you can set the compiler loose on your code: you can use the open source java command line application, you can simply plug your script into the simple online web application or you can even make use of their full RESTful API.

The benefits of using this great little system do of course not need that much explanation. Firstly, in terms of efficiency, using the Closure Compiler will result in smaller javascript files which in turn means faster loading applications which obviously means reduced bandwidth needs. In terms of code checking, Closure Compiler provides warnings for illegal javascript as well as for potentially dangerous operations, resulting in less buggy scripts and scripts that are simply easier to maintain.

And just in case you were wondering why you should give them a spin, take note that jQuery have moved to the Closure Compiler to produce their minified scripts.

So what are you waiting for? ;)

Related Link: http://code.google.com/closure/compiler/