Django Compressor
=================
.. image:: https://codecov.io/github/django-compressor/django-compressor/coverage.svg?branch=develop
:target: https://codecov.io/github/django-compressor/django-compressor?branch=develop
.. image:: https://img.shields.io/pypi/v/django_compressor.svg
:target: https://pypi.python.org/pypi/django_compressor
.. image:: https://img.shields.io/github/actions/workflow/status/django-compressor/django-compressor/ci.yml?branch=develop
:alt: Build Status
:target: https://github.com/django-compressor/django-compressor/actions?query=workflow%3ACI
Django Compressor processes, combines and minifies linked and inline
Javascript or CSS in a Django template into cacheable static files.
It supports compilers such as coffeescript, LESS and SASS and is
extensible by custom processing steps.
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.
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.
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 & Extensibility
-------------------------------
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
write a custom parser.
Django Compressor also comes with built-in support for
`YUI CSS and JS`_ compressor, `yUglify CSS and JS`_ compressor, Google's
`Closure Compiler`_, a Python port of Douglas Crockford's JSmin_, a Python port
of the YUI CSS Compressor csscompressor_ and a filter to convert (some) images into
`data URIs`_.
If your setup requires a different compressor or other post-processing
tool it will be fairly easy to implement a custom filter. Simply extend
from one of the available base classes.
More documentation about the usage and settings of Django Compressor can be
found on `django-compressor.readthedocs.org`_.
The source code for Django Compressor can be found and contributed to on
`github.com/django-compressor/django-compressor`_. There you can also file tickets.
The in-development version of Django Compressor can be installed with
``pip install git+https://github.com/django-compressor/django-compressor.git``
.. _BeautifulSoup: http://www.crummy.com/software/BeautifulSoup/
.. _lxml: http://lxml.de/
.. _html5lib: https://github.com/html5lib/html5lib-python
.. _YUI CSS and JS: http://developer.yahoo.com/yui/compressor/
.. _yUglify CSS and JS: https://github.com/yui/yuglify
.. _Closure Compiler: http://code.google.com/closure/compiler/
.. _JSMin: http://www.crockford.com/javascript/jsmin.html
.. _csscompressor: https://github.com/sprymix/csscompressor
.. _data URIs: http://en.wikipedia.org/wiki/Data_URI_scheme
.. _django-compressor.readthedocs.org: https://django-compressor.readthedocs.io/en/latest/
.. _github.com/django-compressor/django-compressor: https://github.com/django-compressor/django-compressor
Raw data
{
"_id": null,
"home_page": "https://django-compressor.readthedocs.io/en/latest/",
"name": "django-compressor",
"maintainer": "Mathieu Pillard",
"docs_url": null,
"requires_python": ">=3.8",
"maintainer_email": null,
"keywords": null,
"author": null,
"author_email": null,
"download_url": "https://files.pythonhosted.org/packages/c5/ae/fa1980e359158f6f03aa601656633e07b22d19e52ac7e110d26ea502040c/django_compressor-4.5.tar.gz",
"platform": null,
"description": "Django Compressor\n=================\n\n.. image:: https://codecov.io/github/django-compressor/django-compressor/coverage.svg?branch=develop\n :target: https://codecov.io/github/django-compressor/django-compressor?branch=develop\n\n.. image:: https://img.shields.io/pypi/v/django_compressor.svg\n :target: https://pypi.python.org/pypi/django_compressor\n\n.. image:: https://img.shields.io/github/actions/workflow/status/django-compressor/django-compressor/ci.yml?branch=develop\n :alt: Build Status\n :target: https://github.com/django-compressor/django-compressor/actions?query=workflow%3ACI\n\nDjango Compressor processes, combines and minifies linked and inline\nJavascript or CSS in a Django template into cacheable static files.\n\nIt supports compilers such as coffeescript, LESS and SASS and is\nextensible by custom processing steps.\n\nHow it works\n------------\nIn your templates, all HTML code between the tags ``{% compress js/css %}`` and\n``{% endcompress %}`` is parsed and searched for CSS or JS. These styles and\nscripts are subsequently processed with optional, configurable compilers and\nfilters.\n\nThe default filter for CSS rewrites paths to static files to be absolute.\nBoth Javascript and CSS files are by default concatenated and minified.\n\nAs the final step the template tag outputs a ``<script>`` or ``<link>``\ntag pointing to the optimized file. Alternatively it can also\ninline the resulting content into the original template directly.\n\nSince the file name is dependent on the content, these files can be given\na far future expiration date without worrying about stale browser caches.\n\nFor increased performance, the concatenation and compressing process\ncan also be run once manually outside of the request/response cycle by using\nthe Django management command ``manage.py compress``.\n\nConfigurability & Extensibility\n-------------------------------\n\nDjango Compressor is highly configurable and extensible. The HTML parsing\nis done using lxml_ or if it's not available Python's built-in HTMLParser by\ndefault. As an alternative Django Compressor provides a BeautifulSoup_ and a\nhtml5lib_ based parser, as well as an abstract base class that makes it easy to\nwrite a custom parser.\n\nDjango Compressor also comes with built-in support for\n`YUI CSS and JS`_ compressor, `yUglify CSS and JS`_ compressor, Google's\n`Closure Compiler`_, a Python port of Douglas Crockford's JSmin_, a Python port\nof the YUI CSS Compressor csscompressor_ and a filter to convert (some) images into\n`data URIs`_.\n\nIf your setup requires a different compressor or other post-processing\ntool it will be fairly easy to implement a custom filter. Simply extend\nfrom one of the available base classes.\n\nMore documentation about the usage and settings of Django Compressor can be\nfound on `django-compressor.readthedocs.org`_.\n\nThe source code for Django Compressor can be found and contributed to on\n`github.com/django-compressor/django-compressor`_. There you can also file tickets.\n\nThe in-development version of Django Compressor can be installed with\n``pip install git+https://github.com/django-compressor/django-compressor.git``\n\n.. _BeautifulSoup: http://www.crummy.com/software/BeautifulSoup/\n.. _lxml: http://lxml.de/\n.. _html5lib: https://github.com/html5lib/html5lib-python\n.. _YUI CSS and JS: http://developer.yahoo.com/yui/compressor/\n.. _yUglify CSS and JS: https://github.com/yui/yuglify\n.. _Closure Compiler: http://code.google.com/closure/compiler/\n.. _JSMin: http://www.crockford.com/javascript/jsmin.html\n.. _csscompressor: https://github.com/sprymix/csscompressor\n.. _data URIs: http://en.wikipedia.org/wiki/Data_URI_scheme\n.. _django-compressor.readthedocs.org: https://django-compressor.readthedocs.io/en/latest/\n.. _github.com/django-compressor/django-compressor: https://github.com/django-compressor/django-compressor\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "('Compresses linked and inline JavaScript or CSS into single cached files.',)",
"version": "4.5",
"project_urls": {
"Homepage": "https://django-compressor.readthedocs.io/en/latest/",
"Source": "https://github.com/django-compressor/django-compressor"
},
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "2b916a55008e9686f35727c1a12401c2bcdc412afc651ffd48994c74166e1e5b",
"md5": "37f96162fcacf0e257c9ffd9f82f28ba",
"sha256": "2c14e1a80a234432153e64035ae1adaf638c1ba8d7fc9e60a7be2fad5697fdbe"
},
"downloads": -1,
"filename": "django_compressor-4.5-py2.py3-none-any.whl",
"has_sig": false,
"md5_digest": "37f96162fcacf0e257c9ffd9f82f28ba",
"packagetype": "bdist_wheel",
"python_version": "py2.py3",
"requires_python": ">=3.8",
"size": 144980,
"upload_time": "2024-06-16T23:48:33",
"upload_time_iso_8601": "2024-06-16T23:48:33.787319Z",
"url": "https://files.pythonhosted.org/packages/2b/91/6a55008e9686f35727c1a12401c2bcdc412afc651ffd48994c74166e1e5b/django_compressor-4.5-py2.py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "c5aefa1980e359158f6f03aa601656633e07b22d19e52ac7e110d26ea502040c",
"md5": "6f19328f65dff9a0c40f55c7ff58968b",
"sha256": "9d98c905b741be6cb09ad828c1d22a9ff9244dd08823e2926af8ddd1871c3c65"
},
"downloads": -1,
"filename": "django_compressor-4.5.tar.gz",
"has_sig": false,
"md5_digest": "6f19328f65dff9a0c40f55c7ff58968b",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.8",
"size": 422011,
"upload_time": "2024-06-16T23:48:35",
"upload_time_iso_8601": "2024-06-16T23:48:35.857121Z",
"url": "https://files.pythonhosted.org/packages/c5/ae/fa1980e359158f6f03aa601656633e07b22d19e52ac7e110d26ea502040c/django_compressor-4.5.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-06-16 23:48:35",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "django-compressor",
"github_project": "django-compressor",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"tox": true,
"lcname": "django-compressor"
}