Web Tutorials     [RO]  [EN]  
| HOME | Tutorials | News | SERVICES | Directory | Tools | FORUM | About | SITE MAP | CONTACT | SEARCH |
.....................................................
.....................................................
User happy birthdayToday we celebrate one day of birth.
(dannyb0y)
.....................................................
Login
Register
I forgot my password
.....................................................
Put your ad here
.....................................................
Online
In total there is
7 visitors online,
of which:
7 are bots
.....................................................
Put your ad here
.....................................................
.....................................................
.....................................................
.....................................................
.
Home - Google's Closure Compiler

<< Organize your project in a broad way   -   Google Webmaster Tools and improving performance >>
Rate this article(Members only)
1 2 3 4 5
A - A Announced this way the site administrator for any problems observed on this page.  Print this page as PDF  Email  

Google's Closure Compiler


Publishing date: 25-02-2011 - Copyright © Claudiu Gilcescu-Ceia

Optimising page load times usually comes down to compressing the content of the website, like compressing and minifying .css or .js files as well as the page and images themselves. While all these have become trivial tasks even for dynamic pages, with different tools to do the compression as well as the plethora of tutorials out there, Javascript was allways a pain. Most websites our days are using frameworks such as jQuery or Mootools to provide a better user experience, but even minimized and compressed they do take a lot of space. Also, there's a lot of uncompressed code that was written by the web page developer that is served as is or in the best case scenario with a standard compression and minification level.

Google goes beyond that and provides the Closure Compiler, a tool that not only minifies any Javascript file, but also removes dead code, issues warnings and errors regarding the script and in the most advance form, it rewrites the code so it's more efficient and browser-compatible. Note tough, that this feature can generate code that doesn't run, so it's advisable that you always test it upfront. It's yet another amazing tool from Google that most web developers need on every project. Also, the tool comes in two flavours, either as a stand-alone, command line Java app or as a web service.

Best part, it also has a RESTful (Representational State Transfer) API, which means you can use it with the programming language of choice, for webpages where you want to compress your own Javascript code it only makes sense to use a server-side language such as PHP. All you have to do is make an HTTP POST request including a few parameters like the actual JS code or file URL and level of compression and you're done.

To make everything perfect, Google also offers Closure Inspector, a Javscript debugger for Firebug, which can revert the minified code and show you the line where the error resides in the original source file, among other cool features.

Enjoy using Closure Compiler and Let's make the web faster!

Related links

You can visit the author's website at blog.hazardousgaming.info

Publishing date: 25-02-2011 - Copyright © Claudiu Gilcescu-Ceia   
Click here if you want to see other articles by the same author

There is a similar article, click here for list.

There are no comments on this article. Be the first to say your opinion.

Add a comment on this article (members only - login on the site):
Put your ad here