|
GettingStarted
How to get started with plovr.
Introductionplovr is a local compile daemon for Closure JS and Soy files. It has the Closure Library and Closure Templates bundled with it, so you only need to download a single jar file and point it to your directory full of source code to get started. Once it is up and running, you can point a script tag at plovr that will load your compiled code: <script src="http://localhost:9810/compile?id=integration-test&mode=ADVANCED"></script> Newer documentation is available on the plovr web site: http://plovr.com/docs.html. The web site also includes a live demo: http://plovr.com/demo/. RequirementsRequires Java 1.6. Running plovrFirst, download the most recent version of plovr from the downloads page. Next, create a configuration file to tell plovr where your source code is. Currently, config files are written in JSON, and you can view a sample config file in the repository. Although // and /** */ style comments are not strictly allowed in JSON, they are allowed in plovr config files. There are three important keys in the root object of the JSON config file: id, paths, and inputs: {
// This comment is allowed even though it is not valid JSON.
"id": "integration-test",
"paths": "testdata",
"inputs": "testdata/example/main.js"
}
The complete set of plovr config options can be seen at http://www.plovr.com/options.html. Once you have created a config file, start plovr by running: java -jar plovr.jar serve <config-file-1> <config-file-2> This will start an HTTP server on localhost:9810. To get plovr to do the compilation specified in the config file, load the following in a web browser: http://localhost:9810/compile?id=ID_FROM_CONFIG_FILE By default, code will be compiled using SIMPLE_OPTIMIZATIONS, but it is possible to add a mode query parameter to override that setting: http://localhost:9810/compile?id=ID_FROM_CONFIG_FILE&mode=ADVANCED The supported values for mode are:
Values for mode are case-insensitive. Building with plovrIf you just want plovr to write a file, run: java -jar plovr.jar build <config-file> and it will do its compilation based on the settings in config-file and print the results to standard out. Other features of plovr when run in server modeWhen the serve argument is passed to plovr to run it as a compiler daemon, there are other URLs that you can visit as well to get information about your compilation. File SizeTo see a breakdown of the compiled size of each file, visit: http://localhost:9810/size?id=ID_FROM_CONFIG_FILE Unfortunately, the UI is not that great right now, but it can help identify where code bloat is coming from. Source MapTo get the source map of the last compilation done by plovr, visit: http://localhost:9810/sourcemap?id=ID_FROM_CONFIG_FILE This should make it easier to debug your code with the Closure Inspector. |
It's working! I had to clean up my big mess, first -- from installing all the separate tools, per the Google Tutorials... plovr is much neater, and much more Google-like! big thanks!
This is really great but I would love to see more flexibility built into the 'build' mode as the 'server' mode really isn't my cup of tea.