Commit f420dae8 by Timothée Peignier

less chit-chat, more useful docs

parent f3981488
......@@ -67,10 +67,21 @@ Group options
Is the filename of the (to be) compressed file.
``variant``
...........
**Optional**
Is the variant you want to apply to your CSS. This allow you to embed images and
fonts in CSS with data-URI.
Allowed values are : ``None`` or ``datauri``.
Defaults to ``None``.
``extra_context``
.................
**Optionnal**
**Optional**
Is a dictionary of values to add to the template context,
when generating the HTML for the HTML-tags with the templatetags.
......@@ -92,7 +103,7 @@ Other settings
When ``COMPRESS`` is ``True``, CSS and JavaScripts will be concatenated and filtered.
When ``False``, the source-files will be used instead.
Defaults to ``not DEBUG`` (compressed files will only be used when ``DEBUG`` is ``False``)
Defaults to ``not DEBUG`` (compressed files will only be used when ``DEBUG`` is ``False``).
``COMPRESS_AUTO``
.................
......@@ -247,6 +258,4 @@ some horsepower to google which leads us as hinted in the example above to the n
.. note::
external urls is currently only available for javascript. There's currently no
reason to have external css files (Yes there are css frameworks as well on the net
but they are often very small or generated to fit your needs)
External urls is currently only available for javascript.
.. _ref-features:
========
Features
========
This is a application that will provide an easy and automated way to output
compressed/minified CSS and JavaScript.
It adheres to the DRY principle, you set up your CSS-files and JavaScript-files
in your project settings, and you are done.
There is no need to enter the names in your template again (a couple of template tags takes care of that).
* Group and concatenate your stylesheets and jaavscripts source files to single files,
and run the code through specified compressors.
* Provides sane defaults for CSS and JavaScript minification (YUI compressor required).
* A compressor for **YUI Compressor**, **Google Closure Compiler**, **UglifyJS** is included.
* It’s easy and straightforward to write custom compressors to generate the output.
* A last-modification and/or version part can automatically be appended to the filename
of the outputted files to make use of “far future Expires HTTP header),
and provide an automated way of updating the content without delays.
* You setup and group your CSS and JavaScript-files in the settings,
and set up whetter or not you want your files to be compressed.
* Templatetags to output CSS (``<link>``) or JavaScript (``<script>``) tags
with the compressed files if ``COMPRESS = True``, or otherwise the source files.
* The compressed files will be updated (if needed) when you are accessing them
from the templatetags.
This only applies when ``COMPRESS_AUTO`` is enabled.
You can manually update them with ``./manage.py synccompress``.
......@@ -6,36 +6,11 @@
Introduction
============
JavaScript and CSS minification/compression can decrease load times of sites a lot.
It is important to reduce the number of requests that are made.
Fewer files means better performance. However, when you develop CSS, and particularly
if you are building a big site, it can be nice to separate different parts of the site’s CSS into different files.
You also want to keep the CSS and JavaScript in different files while you develop, to make debugging easier.
django-compress is an asset packaging library for Django, providing
both CSS and JavaScript concatenation and compression, built-in JavaScript
template support, and optional data-URI image and font embedding.
It is also nice to comment CSS and JavaScript, but you do not want the overhead
of sending the comments and whitespaces to the clients.
You also want to make sure that as much of the static content is cached as much
as possible at the client.
The ideal is to even avoid “304 Not Modified” which are returned when a client
requested something that has already been cached, and does not need to be updated.
This can be accomplished by setting the HTTP Expire header to a date far in the future.
That will force the browser not to ask for updates for that URL.
However, when you need to update your files, you will need to give them a new URL,
to push the updated files to the clients.
These techniques has been described more in depth at Yahoo:
* http://developer.yahoo.com/performance/rules.html#num_http
* http://developer.yahoo.com/performance/rules.html#minify
* http://developer.yahoo.com/performance/rules.html#expires
django-compress tries to address those issues with as little manual intervention
as possible, whilst still being configurable enough to not get in your way.
Read more about the :doc:`features`.
There are numerous of other techniques that could be used to improve performance,
Yahoo has an excellent page that lists the most common: http://developer.yahoo.com/performance/rules.html
You can report bugs and discuss features on the `issues page <https://github.com/cyberdelia/django-compress/issues>`_.
Table Of Contents
=================
......@@ -43,13 +18,12 @@ Table Of Contents
.. toctree::
:maxdepth: 2
features
installation
usage
configuration
versioning
usage
compressors
compilers
versioning
farfutureexpires
backwardsincompatiblechanges
......
......@@ -4,18 +4,16 @@
Installation
============
Installation is pretty straight-forward and follows the same installation
procedure as many other *Django* applications.
1. Either check out django-compress from GitHub_ or to pull a release off PyPI_ ::
``django-compress`` does not create any models, so you do not need to configure a database.
pip install django-compress
Install instructions
====================
1. Either check out django-compress from GitHub_ or to pull a release off PyPI_.
Doing ``pip install django-compress`` or ``easy_install django-compress`` is all that should be required.
2. Add 'compress' to your ``INSTALLED_APPS`` ::
2. Add 'compress' to your ``INSTALLED_APPS``
INSTALLED_APPS = (
'compress',
)
.. _GitHub: http://github.com/pelme/django-compress
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment