plovr demo page
This is a demo for plovr, a Closure build tool.About plovr
plovr is a bulid tool that dynamically recompiles JavaScript and Closure Template code. Once you create a simple configuration file to tell plovr where the JS and Soy files to compile are on your local machine, simply run the plovr jar with the config file to start compiling your code. The output of plovr can be included via a <script>
tag.
Visit the downloads page on code.google.com to get the latest plovr binary, or check out the source and build it yourself.
Live Examples
plovr is running live on plovr.com, so take a look at the config file it uses and the test pages that load its output. This instance of plovr was started by running:java -jar plovr.jar serve demo-config.js
The config file tells plovr to compile example/main.js and to look in example when searching for its JavaScript and Soy dependencies. By default, any JavaScript file in the Closure Library (as well as soyutils_usegoog.js) may also be transitively included as a dependency.
Using plovr eliminates the need to run calcdeps.py
and java -jar SoyToJsSrcCompiler.jar
as separate build steps. More importantly, when changes are made to the input files, there is no need to restart plovr—just refresh the web page that loads its output and plovr will recompile the inputs!
- Example of using plovr in
RAW
mode. [test page]
InRAW
mode, each input file is loaded via its own<script>
tag as a result of loading the plovr<script>
tag. Each input.soy
file is converted to a JavaScript file, and is also loaded in its own<script>
tag. The order of the<script>
tags is determined by topologically sorting the inputs based on their calls togoog.provide()
andgoog.require()
, just ascalcdeps.py
would do. - Example of using plovr in
WHITESPACE
mode. [test page]
InWHITESPACE
mode, after being topologically sorted, all input files are concatenated together into a single JavaScript file with all whitespace and comments removed using the WHITESPACE_ONLY mode of the Closure Compiler. - Example of using plovr in
SIMPLE
mode. [test page]
InSIMPLE
mode, the input is compiled using the Closure Compiler'sSIMPLE_OPTIMIZATIONS
mode. - Example of using plovr in
ADVANCED
mode. [test page]
InADVANCED
mode, the input is compiled using the Closure Compiler'sADVANCED_OPTIMIZATIONS
mode.