Example: Using plovr to leverage the modules feature of the Closure Compiler

This page demonstrates how modules are loaded by the plovr server in SIMPLE mode. If you take a look at the DOM with your browser, you can see how clicking Load Settings will dynamically load the script tags for the settings module (they are added as children of the <html> element, not the <head> or <body> elements).

This example is based on the one in Chapter 12 of Closure: The Definitive Guide in the "Partitioning Compiled Code into Modules" section. It describes a root app module that can dynamically load settings and api modules. Instead of the unmaintainable 72 line shell script required to run the Closure Compiler with all of the appropriate module options, consider the much more compact plovr config file. Unlike the shell script, the config file will not have to be edited as input files are added to the modules. Although this example uses a fairly simple module structure, you can see from the unit test that plovr is able to handle more complex module structures.

If you have an SVG-enabled browser, you can also view the module diagram generated by plovr that helps illustrate the module breakdown.