For those textmate folks interested, I just wrote this:
You'll need curl installed, and the json ruby gems (`sudo gem install
json` from terminal)
In TextMate, open Bundles>Bundle Editor>Show Bundle Editor
Create a new bundle (Google Closure)
Add a new command (Advanced Optimization)
Command Params: Input is 'Selected Text' or 'Document'. Output is
'Create New Document'
Add this code to the command:
### START CODE
#!/usr/bin/env ruby
require 'cgi'
require 'rubygems'
require 'json'
doc = CGI.escape(STDIN.read)
cmd = "echo
'output_format=json&output_info=compiled_code&output_info=warnings&output_info=errors&output_info=statistics&compilation_level=ADVANCED_OPTIMIZATIONS&warning_level=verbose&output_file_name=default.js&js_code="+doc
+"' | curl -s -X POST -d @- <a href="
http://closure-
compiler.appspot.com/compile">
http://closure-compiler.appspot.com/compile</a>
"
output = `#{cmd}`
parsedOutput = JSON.parse output
print parsedOutput["compiledCode"]
### END CODE
then open your JS file and execute the command (it'll beachball
briefly - it's not async). Should open a new document with the
advanced compressed Closure code.
Next step is handling error from the REST API