Closure is the name some javascript tools which Google made and decided you could use, too. Just barely peeking into these, and they do look pretty interesting.
There’s the Closure compiler. It lets you compile your JavaScript and is billed as a “true compiler for JavaScript”. It
… compiles from JavaScript to better JavaScript. It parses your JavaScript, analyzes it, removes dead code and rewrites and minimizes what’s left. It also checks syntax, variable references, and types, and warns about common JavaScript pitfalls.
So, that’s neat. Also, it works pretty well. You need Java installed, but assuming that is there you just do something like
java -jar compiler.jar --js=my_large_bulky_javascript_file.js
--js_output_file=now_its_small.js
And there you go. Small little js code, evidently smaller than simply minifying it.
There is also the Closure Library, and Closure templates, both of which look possibly useful. Probably more there for a future post.