JS Compression — Static Media Manager v0.4 documentation

Static Media Manager v0.4 documentation

# JS Compression

- Table of Contents
- index
  modules
  next
  previous

# JS Compression

There are two ways to compress javascript, the first is using a python port of Douglas Crockford’s jsmin . The second is using a user specified command.

## Internal `jsmin`

Simply set the STATIC_MEDIA_COMPRESS_JS setting to `True`.

## External Command

First you must set the STATIC_MEDIA_COMPRESS_JS setting to `True`.

Then you need to set the STATIC_MEDIA_JS_COMPRESSION_CMD setting to the appropriate command string. The command string should include `%(infile)s` and `%(outfile)s` placeholders for the in and out file paths.

For example, to use the new Google Closure Compiler your command string might look like:

    java -jar ~/compiler-latest/compiler.jar --js %(infile)s --js_output_file %(outfile)s