Update README: Mention support of coffeescript and sass and compatible django versions
This commit is contained in:
parent
ee7d15a6d7
commit
f87f631225
43
README.rst
43
README.rst
|
@ -14,34 +14,39 @@ Django Compressor
|
|||
.. image:: https://caniusepython3.com/project/django_compressor.svg
|
||||
:target: https://caniusepython3.com/project/django_compressor
|
||||
|
||||
Django Compressor combines and compresses linked and inline Javascript
|
||||
or CSS in a Django template into cacheable static files by using the
|
||||
``compress`` template tag.
|
||||
Django Compressor processes, combines and minifies linked and inline
|
||||
Javascript or CSS in a Django template into cacheable static files.
|
||||
|
||||
HTML in between ``{% compress js/css %}`` and ``{% endcompress %}`` is
|
||||
parsed and searched for CSS or JS. These styles and scripts are subsequently
|
||||
processed with optional, configurable compilers and filters.
|
||||
It supports compilers such as coffeescript, LESS and SASS and is
|
||||
extensible by custom processing steps.
|
||||
|
||||
The default filter for CSS rewrites paths to static files to be absolute
|
||||
and adds a cache busting timestamp. For Javascript the default filter
|
||||
compresses it using ``jsmin``.
|
||||
Django Compressor is compatible with Django 1.8 and newer.
|
||||
|
||||
As the final result the template tag outputs a ``<script>`` or ``<link>``
|
||||
tag pointing to the optimized file. These files are stored inside a folder
|
||||
and given a unique name based on their content. Alternatively it can also
|
||||
return the resulting content to the original template directly.
|
||||
How it works
|
||||
------------
|
||||
In your templates, all HTML code between the tags ``{% compress js/css %}`` and
|
||||
``{% endcompress %}`` is parsed and searched for CSS or JS. These styles and
|
||||
scripts are subsequently processed with optional, configurable compilers and
|
||||
filters.
|
||||
|
||||
Since the file name is dependent on the content these files can be given
|
||||
The default filter for CSS rewrites paths to static files to be absolute.
|
||||
Both Javascript and CSS files are by default concatenated and minified.
|
||||
|
||||
As the final step the template tag outputs a ``<script>`` or ``<link>``
|
||||
tag pointing to the optimized file. Alternatively it can also
|
||||
inline the resulting content into the original template directly.
|
||||
|
||||
Since the file name is dependent on the content, these files can be given
|
||||
a far future expiration date without worrying about stale browser caches.
|
||||
|
||||
The concatenation and compressing process can also be jump started outside
|
||||
of the request/response cycle by using the Django management command
|
||||
``manage.py compress``.
|
||||
For increased performance, the concatenation and compressing process
|
||||
can also be run once manually outside of the request/response cycle by using
|
||||
the Django management command ``manage.py compress``.
|
||||
|
||||
Configurability & Extendibility
|
||||
Configurability & Extensibility
|
||||
-------------------------------
|
||||
|
||||
Django Compressor is highly configurable and extendible. The HTML parsing
|
||||
Django Compressor is highly configurable and extensible. The HTML parsing
|
||||
is done using lxml_ or if it's not available Python's built-in HTMLParser by
|
||||
default. As an alternative Django Compressor provides a BeautifulSoup_ and a
|
||||
html5lib_ based parser, as well as an abstract base class that makes it easy to
|
||||
|
|
Loading…
Reference in New Issue