django-compressor


Namedjango-compressor JSON
Version 4.4 PyPI version JSON
download
home_pagehttps://django-compressor.readthedocs.io/en/latest/
Summary('Compresses linked and inline JavaScript or CSS into single cached files.',)
upload_time2023-06-27 22:13:19
maintainerMathieu Pillard
docs_urlNone
author
requires_python
licenseMIT
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            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": "",
    "maintainer_email": "",
    "keywords": "",
    "author": "",
    "author_email": "",
    "download_url": "https://files.pythonhosted.org/packages/1c/7d/8b878b082d7aca3f3d76da1743754d2a812571d0ee2cccbb6ee543f05843/django_compressor-4.4.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.4",
    "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": "a0b53c000d6d7b8ffa8831d2ef5bcbbe5780de172024e226ec89391853d4b759",
                "md5": "74f93709d784da6c3585bd53f43d1d04",
                "sha256": "6e2b0c0becb9607f5099c2546a824c5b84a6918a34bc37a8a622ffa250313596"
            },
            "downloads": -1,
            "filename": "django_compressor-4.4-py2.py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "74f93709d784da6c3585bd53f43d1d04",
            "packagetype": "bdist_wheel",
            "python_version": "py2.py3",
            "requires_python": null,
            "size": 148954,
            "upload_time": "2023-06-27T22:13:17",
            "upload_time_iso_8601": "2023-06-27T22:13:17.910183Z",
            "url": "https://files.pythonhosted.org/packages/a0/b5/3c000d6d7b8ffa8831d2ef5bcbbe5780de172024e226ec89391853d4b759/django_compressor-4.4-py2.py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "1c7d8b878b082d7aca3f3d76da1743754d2a812571d0ee2cccbb6ee543f05843",
                "md5": "a7c6054c4c5a873b317d88b6a62a606a",
                "sha256": "1b0acc9cfba9f69bc38e7c41da9b0d70a20bc95587b643ffef9609cf46064f67"
            },
            "downloads": -1,
            "filename": "django_compressor-4.4.tar.gz",
            "has_sig": false,
            "md5_digest": "a7c6054c4c5a873b317d88b6a62a606a",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 422254,
            "upload_time": "2023-06-27T22:13:19",
            "upload_time_iso_8601": "2023-06-27T22:13:19.961332Z",
            "url": "https://files.pythonhosted.org/packages/1c/7d/8b878b082d7aca3f3d76da1743754d2a812571d0ee2cccbb6ee543f05843/django_compressor-4.4.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-06-27 22:13:19",
    "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"
}
        
Elapsed time: 0.11250s