Michael Kerrin

Web, Python, JavaScript and related technologies

pwt.recipe.closurebuilder

with one comment

Its been a while but I am going to be releasing some open source packages in the near future.

First up is pwt.recipe.closurebuilder. This is a zc.buildout recipe that integrates with closure-library build system. Then pwt.recipe.closurebuilder makes it easy to find and minify all your JavaScript files that make up your application into one or more files. Obviously if you don’t use zc.buildout that it is not going to be of much use, but the idea behind the closure JavaScript dependencies is worth reading about IMO.

pwt.recipe.closurebuilder contains two recipes. One to generate a JavaScript file containing a database of dependencies between all your JS files using closure library namespaces. This is equivalent to the depswriter tool from Google.

The second recipe invokes the closure compiler to produce a minimized version of your code base. It uses the information gathered through the first recipe to find a list of all the files that you want to collect and minify into one small JavaScript file. This file is saved in a output directory specified by you and whose name is the md5 sum of the contents of the generated JavaScript file. This recipe is equivalent to the closurebuilder tool from Google.

The closure compiler is the best JavaScript to JavaScript compiler out there that minimizes your code the most. But using it repeatable and consistently can be a problem. As I use zc.buildout whenever possible integrating the minimization of your JavaScript into my build system of choice makes life easier.

Advertisements

Written by mkerrin

2011, February 22 at 9:08 am

One Response

Subscribe to comments with RSS.

  1. […] up on my pwt.recipe.closurebuilder announcement, I have pushed a new project to github called pwt.jscompiler. The goal of this project […]


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: