Thursday, November 5, 2009

Google releases Closure Tools!

Today Google released a suite of JavaScript tools that are used to construct massive web applications such as Gmail and Google Docs. The suite is named Closure Tools, and I think you'll find it superior to existing offerings, particularly with respect to minifying JavaScript. The post on the Google Code blog links to a ton of new code and documentation, so trying to determine where to start can be overwhelming.

I used all of these tools when I worked at Google, so there is a lot I could write about them, but for now I'm just going to try to convince you that the Closure Compiler is not your ordinary JavaScript minifier. There is a web version of the Compiler that you can play with to convince yourself that it is worth learning more about. If you go to the site, you will see the following code:

// ADD YOUR CODE HERE
function hello(name) {
alert('Hello, ' + name);
}
hello('New user');

Using the Compile button to run the Compiler, try each of the options to the right of the Optimization: label when compiling the sample code. The compiled code appears in the first tab on the right side of the screen. Note that running with the Advanced option, the code is compiled down to:

alert("Hello, New user");

Now that's some serious inlining! Can your minifier do that? Probably not. To get the maximum benefit out of Closure Tools, you should fix your JavaScript code so that it compiles in Advanced mode. Reading Google's article on advanced compilation is the quickest way to learn what the Compiler expects from your JavaScript, and it should also give you an idea of what other optimizations the Compiler is capable of.

14 comments:

  1. If you constantly find yourself fumbling through each of your essay papers then having our services will take the load off your shoulders considerably. With our online essay writing help services, you will be able to unlock the potential to receive many laurels for your performance.

    Write my essay for me

    ReplyDelete
  2. Entryways are very significant for different reasons, these entryways ensure that creepy crawlies. different bugs don't go into the house, little children and pets wait at home
    Aluminum screen supplier

    ReplyDelete
  3. Such a wonderful article. Your blog is great. If you want to read interestingarticles on educational topic, you have to visit a site https://exclusive-paper.net/essays/free-speech-examples/gender-discrimination-persuasive-speech-outline.php.

    ReplyDelete
  4. Our buyers are our assets. And we don’t hesitate to go the extra mile to Halal Meat Near Me serve them with the best. We make sure no one waits and keep shelves full of groceries 24 hours a day.

    ReplyDelete
  5. Dr. Samra-Latif Estafan is committed to helping you Botox/Xeomin Aesthetic achieve wellness and total health through a holistic and integrative approach to dedicated healthcare.

    ReplyDelete
  6. Law Offices Of Rizwan M. Khalid is here to protect your legal rights and help defend you in need. Immigration clients are served throughout the United States and the world. Other legal Top Philadelphia Law Firms services are offered only in New Jersey and Pennsylvania.

    ReplyDelete
  7. Kabobi serves you Halal food. We offer you healthy and delicious Kabobeesh Menu food. You can order a variety of food from our Halal food menu, which would be served to you in minutes.

    ReplyDelete
  8. Williamson Caterers is a preferred caterer for williamson restaurant venues and historic locations throughout the region. We also bring our services to your home, place of worship, office, school or any unique location you may find.

    ReplyDelete
  9. On the off chance that you continually end up mishandling through every one of your article Accounting Homework Help papers, at that point having our administrations will take the heap off your shoulders impressively. A particularly brilliant article. Your blog is incredible. On the off chance that you need to peruse intriguing articles on instructive themes.

    ReplyDelete
  10. Hello. Your article is great. I am very happy to visit interesting blogs. I started using article writing services. I know I can get any help.

    ReplyDelete
  11. Kamsoft is a spirited contemporary IT company that enables brands to take the leap using advanced technological tools and expert developmental assistance. Since our formation, Kamsoft Technologies have accomplished so much in the technological industry and has become one of USA & Pakistan's biggest IT companies.

    ReplyDelete
  12. Prolific Studio as an Animation Company offers a wide and extensive range of animated video production services with creative ideas and flawless designs in competitive prices make an animated logo and affordable packages. We focus on delivering quality animations.

    ReplyDelete
  13. Zonas online store selling women clothing underwear and accessories all over Australia. Our exclusive products are menstrual and maternity range. We want to cater women's with all their special needs giving them comfier apparel at affordable prices. Our menstrual panties are highly absorbent, leakproof, breathable, reusable, environmental friendly, odorless Period Knickers and easy wash. We have a wide range of sizes, styles and colors. Soon we gonna launch our maternity and activewear range. That's not enough much more to come, variety of fashionable attires + under garments so keep in touch.

    ReplyDelete