camptocamp / c2c.recipe.closurecompile

A buildout recipe to compile javascript with the Google Closure Compiler
MIT License
2 stars 3 forks source link

c2c.recipe.closurecompile

Compress javascript files using the Google Closure Compiler <http://code.google.com/closure/compiler/>_

Usage

Minimal buildout config example::

[buildout]
parts = closure-compile

[closure-compile]
recipe = c2c.recipe.closurecompile
compiler = path/to/closure-compiler.jar
level = SIMPLE_OPTIMIZATIONS
source_map = foo/bar.map
externs = externs/a.js externs/b.js
input = foo/bar.js
output = foo/bar.min.js
output_mode = compiled
compiler_flags = --generate_exports

Where:

depswriter

Writes dependency files with DepsWriter <http://code.google.com/closure/library/docs/depswriter.html>_.

Minimal buildout config example::

[buildout]
parts = depswriter

[closure-compile]
recipe = c2c.recipe.closurecompile:depswriter
root_with_prefix = myproject ../../myproject
                   ../source/ ../../../../source/
output = path/to/deps.js

Where:

Note that the root and the path_with_depspath options from the original depswriter.py script are not yet supported.

Getting the jar

To automatically download and unzip the compiler from Google, you can use the hexagonit.recipe.download receipt::

[buildout]
parts = closure-compile

[closure-compile]
recipe = c2c.recipe.closurecompile
compiler = ${download-closure-compile:destination}/compiler.jar
...

[download-closure-compile]
recipe = hexagonit.recipe.download
url = http://closure-compiler.googlecode.com/files/compiler-latest.zip