<< Great web dev tool: Microsoft Fiddler | Home | IE7 Reviews >>

Javascript - Who wants a compression utility?

When it comes to Ajax apps you can quickly discover that your Javascript code is the major part of your application.

For example my current project is heavily Ajax'ed and contains 4500 lines of Javascript for a tiny 100 lines of HTML and 200 lines of Java server code (excluding libraries). Something like 2% HTML, 4% Java and 96% Javascript!

DWR contains a Javascript compressor and various other Javascript utilities. (You can take a look at the source through CVS at java.net). I put it together becuase I didn't know of any other Java based Javascript compressors under ASF-like licenses, and it occurs to me that other people might find it useful. I can see it being wrapped in an Ant task or as a Servlet Filter.

The question is "Would you like a free one in Java?", is it worth someone's time taking my code and packaging it separately? Please comment if you would use it or if you want to take the Javascript code from DWR and maintain it yourself.

Other languages

For the record I've found Javascript compressors in various languages:

Web based:

I'm sure there are a hundred more web based ones, given freely available Javascript based compressors, it's not like it's a hard page to write. Talking of which:

Javascript Based:

.Net Based:

Commercial:

Tags :


Re: Javascript - Who wants a compression utility?

Great information, and great links. Thanks Joe!

Re: Javascript - Who wants a compression utility?

Two we like: http://www.crockford.com/javascript/jsmin.html http://dojotoolkit.org/docs/compressor_system.html The 2nd is one I'd like to use but our app is to large at the moment for Rhino to parse it. Seems like a good approach to getting the files really small *without* breaking the external API.

Re: Javascript - Who wants a compression utility?

Joe, happened to stumble across your entry while looking for a servlet filter to compress javascript. I'd love to see a Java library for compressing javascript! I can definitely see it getting wrapped in an Ant build script so that the js is compressed without adding any overhead to the app.