Included Filters

jsmin

class django_assets.filter.jsmin.JSMinFilter

Minifies Javascript by removing whitespace, comments, etc.

Based on Baruch Even’s port of Douglas Crockford’s JSMin, which is included, so no external dependency is required.

jspacker

class django_assets.filter.jspacker.JSPackerFilter

Reduces the size of Javascript using an inline compression algorithm, i.e. the script will be unpacked on the client side by the browser.

Based on Dean Edwards’ jspacker 2, as ported by Florian Schulze.

cssutils

class django_assets.filter.cssutils.CSSUtilsFilter

Minifies CSS by removing whitespace, comments etc., using the Python cssutils library.

Note that since this works as a parser on the syntax level, so invalid CSS input could potentially result in data loss.

yui_css, yui_js

Minify Javascript and CSS with YUI Compressor.

YUI Compressor is an external tool written in Java, which needs to be available. You can define a YUI_COMPRESSOR_PATH setting that points to the .jar file. Otherwise, an environment variable by the same name is tried. The filter will also look for a JAVA_HOME environment variable to run the .jar file, or will otherwise assume that java is on the system path.

class django_assets.filter.yui.YUIJSFilter
class django_assets.filter.yui.YUICSSFilter

gzip

class django_assets.filter.gzip.GZipFilter

Applies gzip compression to the content given.

This can be used if you are unable to let the webserver do the compression on the fly, or just want to do precaching for additional performance.

Note that you will still need to configure your webserver to send the files out marked as gzipped.

cssrewrite

class django_assets.filter.cssrewrite.CSSRewriteFilter

Source filter that rewrites relative urls in CSS files.

CSS allows you to specify urls relative to the location of the CSS file. However, you may want to store your compressed assets in a different place than source files, or merge source files from different locations. This would then break these relative CSS references, since the base URL changed.

This filter transparently rewrites CSS url() instructions in the source files to make them relative to the location of the output path. It works as a source filter, i.e. it is applied individually to each source file before they are merged.

No configuration is necessary.

clevercss

class django_assets.filter.clevercss.CleverCSSFilter

Converts CleverCSS markup to real CSS.

If you want to combine it with other CSS filters, make sure this one runs first.

less

class django_assets.filter.less.LessFilter

Converts Less markup to real CSS.

If you want to combine it with other CSS filters, make sure this one runs first.

Note: Currently, this needs to be the very first filter applied. Changes by filters that ran before will be lost.

Table Of Contents

Previous topic

Building assets

Next topic

Creating custom filters

This Page