>
 





On November 5th, Google released Closure Compiler for Javascript optimization. The strongest part of the Closure Compiler is that it does not only remove whitespace but also rewrites Javascript Code to make it smaller. It also optimizes your Javascript code to perform better. You can find more details and all of its features on my previous article: Closure Compiler – Javascript Compiler by Google.

During my tests, Closure Compiler reduced Javascripts more than 60%. Considering, the size of Javascript files that modern websites have and the reduction before HTTP compression, Closure Compiler is really useful. 

Closure Compiler comes with a Java based command line tool and a RESTful API.  RESTful API works great and very fast. API can be used with a MSBuild or NAnt script to automatically compress Javascript files.

I wrote a C# wrapper for the Google Closure Compiler:

Google's Javascript compressor - C# wrapper
C# wrapper for the Google Closure Compiler

 

The Closure Compiler has three compilation levels:

Below is an example of using the Google Closure Compiler C# wrapper with ASP.NET

Compress googleClosure = new Compress();
string script = googleClosure(Server.MapPath("~/script.js");

Download Closure.cs

Want automatic updates? Subscribe to our RSS feed or
Get Email Updates sent directly to your inbox!

Currently rated 5.0 by 1 people

  • Currently 5/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5


Comments

November 8. 2009 22:24

Social comments and analytics for this post

This post was mentioned on Twitter by bloggingdev: C# Wrapper for Google Closure Compiler - Compressing Javascript Files on-the-fly with ASP.NET and Closure Compiler http://su.pr/1JZSBs

uberVU - social comments | Reply

November 8. 2009 22:34

Pingback from topsy.com

Twitter Trackbacks for
        
        C# Wrapper for Google Closure Compiler - Compressing Javascript Files on-the-fly with ASP.NET and Closure
        [bloggingdeveloper.com]
        on Topsy.com

topsy.com | Reply

November 9. 2009 13:21

Using Google Closure Compiler with PHP 5

Using Google Closure Compiler with PHP 5

Blogging Developer | Reply

November 9. 2009 17:58

Pingback from jasper22.wordpress.com

C# Wrapper for Google Closure Compiler – Compressing Javascript Files on-the-fly with ASP.NET and Closure Compiler « Jasper Blog

jasper22.wordpress.com | Reply

March 15. 2010 14:50

What is a friend? I will tell you... it is someone with whom you dare to be yourself.

cash advance | Reply

Add comment




(Will not be displayed!)