Hacker News new | past | comments | ask | show | jobs | submit login
Introducing Jake: A Build Tool for JavaScript (cappuccino.org)
28 points by sant0sk1 on April 28, 2010 | hide | past | favorite | 9 comments



This is one important part of our efforts to bring JavaScript up to par with other general purpose scripting languages.

Also check out Narwhal (our current non-browser JavaScript platform of choice: http://narwhaljs.org/ ), Jack (a port of a Rack: http://jackjs.org/ ) and all the work being done by CommonJS (attempting to standardize some of these APIs: http://commonjs.org/ )


I feel like I'm about to ask a really stupid question:

Why not simply set your server up to serve javascript files nicely gzipped? The end file will be way smaller than anything minified, which will have much more of an effect on the end-user surely?


If you aren't using gzip, you're crazy. But gzipping is one small piece of the puzzle. Even the simplest web application would benefit from the concatenation and minification of its scripts. Plus, as it turns out, those aren't the only things that real apps need to do.

In Cappuccino, we have a whole suite of tools that operate on applications, and Jake is the conductor. Our preprocessor gets run ahead of time before deploying for performance, a process easily automated with Jake. Images get base64'd and combined into a single file to improve download speed and perceived performance, again completely automated with Jake. We have a tool to strip dead code that Jake knows how to run, and a tool that combines apps into a single file as well.

Our jake scripts handle our deployment process too, creating zip files of everything that's relevant and preparing them for upload to our servers, incrementing version numbers automatically, etc. Turns out automation is important.


Not to mention that even if it were the case that gzipping were enough, closure-compiler is actually specifically designed to generate code that gzips to smaller sized (those google guys know what they're doing ;))


Grr, how did I forget to mention concatenation ;)

Anyway, I agree that there are lots of little tricks, and you've got me thinking now. My only gripe with spriting images etc has been the pain of maintenance. If that's taken away with nice automation, well, that could be very good indeed :)


If you look at the end of the article we link to the post explaining our unique way of handling image spriting that is completely automatic in Cappuccino projects.


Nice one, am enjoying reading about how it works now. I think you've converted me :)


Minification provides a nice degree of obfuscation as well.

If for nothing else, it's nice to be able to put in the standard /* XXX dodgy hack, talk to Pete before touching this code */ stuff without worrying about curious customers seeing it.


One of the nice things about the Closure compiler is it prunes dead code for you. So, for example your original source can include test harnesses or full unit tests and as long as you wrap the code definitions with a global flag set to false that test code doesn't ship in the minified version.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: