Version: 5.1.1

closure-compile: Compile and compress JavaScript source with the Google Closure Compiler

This library exposes the Google Closure compiler to Racket.

The module requires runtime access to Java; the value of (find-executable-path "java") should point to a valid Java executable.

 (require (planet dyoo/closure-compile:1:1))
(closure-compile code [compilation-level])  string?
  code : string?
  compilation-level : (or/c 'whitespace 'simple 'advanced)
   = 'simple
closure-compile takes the given code and passes it to the Closure compiler. If anything bad happens, it will raise an exn:fail and hold the error message in the exception’s exn-message.


> (closure-compile "alert('hello ' + 'world');")

"alert(\"hello world\");\n"

> (closure-compile "alert('hello, I see: ' + (3 + 4) + '!');")

"alert(\"hello, I see: 7!\");\n"

> (closure-compile "\n                       var f = function(x) { \n                           return x * x; \n                       };\n                       alert( f(3) );")

"var f=function(a){return a*a};alert(f(3));\n"