Skip to main content

A buildout recipe to compile javascript with the Google Closure Compiler

Project description

Compress javascript files using the Google 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

Where:

  • compiler: The location of the compiler jar file.

  • level: The compilation level: WHITESPACE_ONLY, SIMPLE_OPTIMIZATIONS or ADVANCED_OPTIMIZATIONS. Default is WHITESPACE_ONLY.

  • source_map: Path to the source map file. Optional.

  • externs: A list of optional externs files.

  • input: The files to compress separated with spaces. The path can be absolute or relative to the buildout directory. These files are also used to calculate the dependencies in addition to the namespace option.

  • root: The list of paths that should be traversed to build the dependencies.

  • namespace: One or more namespaces to calculate dependencies for.

  • output: The path to the minified file.

  • output_mode: The type of output to generate from this script. Options are “list” for a list of filenames, “script” for a single script containing the contents of all the files, or “compiled” to produce compiled output with the Closure Compiler. Default is “compiled”.

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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

c2c.recipe.closurecompile-0.3.tar.gz (13.0 kB view details)

Uploaded Source

File details

Details for the file c2c.recipe.closurecompile-0.3.tar.gz.

File metadata

File hashes

Hashes for c2c.recipe.closurecompile-0.3.tar.gz
Algorithm Hash digest
SHA256 56c4c0eb84476e10d371de9ba06df57232c4f63430a3b2b008fe7e6015a41970
MD5 4ff552f52af3718866b69f0de18eb84e
BLAKE2b-256 2d5ec79d98750456af4fe65f4b1d8c418597604c35de54f9f2c0a8fd0718b962

See more details on using hashes here.

Provenance

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page