plovr: open-source alternative to the Closure Compiler Service that runs locally and understands Soy

227 views
Skip to first unread message

bolinfest

unread,
Jun 1, 2010, 2:41:20 PM6/1/10
to Closure Compiler Discuss
Many members of this group have asked for an open-source version of
the Closure Compiler Service (http://closure-compiler.appspot.com/
home), so I think the new solution that I have built (plovr) may be of
use to you, so please take a look: http://code.google.com/p/plovr/wiki/GettingStarted

Instead of downloading the Closure Compiler, Closure Library, and
Closure Templates individually, plovr puts them all together so that
you can just point it at a directory full of your own JS and Soy
files, and plovr will compile them for you. Because plovr runs an HTTP
server, you just change the script tags in the development version of
your web application to point to localhost:9810 (where plovr is
running) to get the compiled version of your code. plovr will re-
compile each time the URL is reloaded, so there is no need to restart
plovr after editing a JS or Soy file.

A short JSON configuration file replaces the arguments that you
previously passed to calcdeps.py. Each config file must contain an id,
which is passed as a query parameter to the HTTP server (plovr can be
started with multiple config files, each with its own id). Therefore,
a script tag using plovr will look something like this:

<script src="http://localhost:9810/config?id=configuration-
id&level=ADVANCED_OPTIMIZATIONS"></script>

Note how the compilation level can also be specified as a query
parameter. (Support for more compiler options via query parameters and/
or the config file is on the Roadmap: http://code.google.com/p/plovr/wiki/Roadmap.)

The project is brand spanking new, so it is not as fully featured as I
would like yet, but I am very interested in feedback from this group
to help decide how to prioritize new features. If nothing else, I
believe this should be faster and simpler than the existing process
where you have to (1) translate Soy files to JS files, (2) parse the
dependencies of soyutils_usegoog.js, all Closure Library files, as
well as your own code, and then (3) run the Compiler. Because the
Closure Library files are read out of the jar, they are immutable, so
their dependencies are only parsed once. Also, because this runs as an
HTTP server, it eliminates the time spent spinning up a new JVM that
calcdeps.py requires.

Cheers,
Michael

gedw99

unread,
Jun 12, 2010, 7:59:32 AM6/12/10
to Closure Compiler Discuss
Hey,

This is really a great idea.

It would be great to use this with Bespin and Play Framework. I think
it would integrate very nicely as both Closure and Play are very much
designed for fast iterative development.

I am pretty set on using Closure for all proejcst with Play, so i
might be able to do this for the proejct if there is enough interest

ged

bolinfest

unread,
Jun 15, 2010, 1:28:48 AM6/15/10
to Closure Compiler Discuss
Thanks! I know a little bit about Bespin, but next to nothing about
Play. The goal is for plovr to be used with all sorts of web
frameworks, not just Java ones, which is why it runs as a separate
application. Hopefully that should make integration easy.

Also, I have just put together a demo page that runs plovr live, so if
you don't feel like downloading it to get an idea of how it works,
please check out the demo:

http://plovr.org/demo/

Enjoy,
Michael
Reply all
Reply to author
Forward
0 new messages