Usage ===== .. code-block:: django {% load compress %} {% compress %} {% endcompress %} Examples -------- .. code-block:: django {% load compress %} {% compress css %} {% endcompress %} Which would be rendered something like: .. code-block:: django or: .. code-block:: django {% load compress %} {% compress js %} {% endcompress %} Which would be rendered something like: .. code-block:: django Linked files must be accesible via :ref:`COMPRESS_URL `. If DEBUG is ``True``, off-site files will throw exceptions. If DEBUG is ``False`` they will be silently stripped. If the :ref:`COMPRESS ` setting is ``False`` (defaults to the opposite of DEBUG) the ``compress`` template tag simply returns exactly what it was given, to ease development. .. warning:: For production sites it is **strongly recommended** to use a real cache backend such as memcached_ to speed up the checks of compressed files. Make sure you set your Django cache backend appropriately (also see :ref:`COMPRESS_CACHE_BACKEND ` and Django's `caching documentation`_). .. _memcached: http://memcached.org/ .. _caching documentation: http://docs.djangoproject.com/en/1.2/topics/cache/#memcached CSS Notes --------- All relative ``url()`` bits specified in linked CSS files are automatically converted to absolute URLs while being processed. Any local absolute URLs (those starting with a ``'/'``) are left alone. Stylesheets that are ``@import``'d are not compressed into the main file. They are left alone. If the media attribute is set on