1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87
|
Quickstart
==========
Installation
------------
* Install Django Compressor with your favorite Python package manager::
pip install django_compressor
* Add ``'compressor'`` to your ``INSTALLED_APPS`` setting::
INSTALLED_APPS = (
# other apps
"compressor",
)
* See the list of :ref:`settings` to modify Django Compressor's
default behaviour and make adjustments for your website.
* In case you use Django's staticfiles_ contrib app you have to add Django
Compressor's file finder to the ``STATICFILES_FINDERS`` setting, like this:
.. code-block:: python
STATICFILES_FINDERS = (
'django.contrib.staticfiles.finders.FileSystemFinder',
'django.contrib.staticfiles.finders.AppDirectoriesFinder',
# other finders..
'compressor.finders.CompressorFinder',
)
* Define :attr:`COMPRESS_ROOT <django.conf.settings.COMPRESS_ROOT>` in settings
if you don't have already ``STATIC_ROOT`` or if you want it in a different
folder.
.. _staticfiles: http://docs.djangoproject.com/en/dev/ref/contrib/staticfiles/
.. _django-staticfiles: http://pypi.python.org/pypi/django-staticfiles
.. _dependencies:
Optional Dependencies
------------
- BeautifulSoup_
For the :attr:`parser <django.conf.settings.COMPRESS_PARSER>`
``compressor.parser.BeautifulSoupParser`` and
``compressor.parser.LxmlParser``::
pip install beautifulsoup4
- lxml_
For the :attr:`parser <django.conf.settings.COMPRESS_PARSER>`
``compressor.parser.LxmlParser``, also requires libxml2_::
STATIC_DEPS=true pip install lxml
- html5lib_
For the :attr:`parser <django.conf.settings.COMPRESS_PARSER>`
``compressor.parser.Html5LibParser``::
pip install html5lib
- `Slim It`_
For the :ref:`Slim It filter <slimit_filter>`
``compressor.filters.jsmin.SlimItFilter``::
pip install slimit
- `csscompressor`_
For the :ref:`csscompressor filter <csscompressor_filter>`
``compressor.filters.cssmin.CSSCompressorFilter``::
pip install csscompressor
.. _BeautifulSoup: http://www.crummy.com/software/BeautifulSoup/
.. _lxml: http://lxml.de/
.. _libxml2: http://xmlsoft.org/
.. _html5lib: https://github.com/html5lib/html5lib-python
.. _`Slim It`: https://github.com/rspivak/slimit
.. _django-appconf: http://pypi.python.org/pypi/django-appconf/
.. _versiontools: http://pypi.python.org/pypi/versiontools/
|