Skip to main content
Help the Python Software Foundation raise $60,000 USD by December 31st!  Building the PSF Q4 Fundraiser

html minify middleware for django

Project description

django-hmin
===========

Django HTML minification middleware (another one, a little bit faster than django-htmlmin)


Installing
==========

For install django-hmin, run on terminal: ::

$ pip install django-hmin


Using the midleware
===================

All you need to do is add two middlewares to your ``MIDDLEWARE_CLASSES`` and
enable the ``HTML_MINIFY`` setting: ::

MIDDLEWARE_CLASSES = (
# other middleware classes
'hmin.middleware.MinMiddleware',
'hmin.middleware.MarkMiddleware',
)

Note that if you're using Django's caching middleware, ``MarkMiddleware``
should go after ``FetchFromCacheMiddleware``, and ``MinMiddleware``
should go after ``UpdateCacheMiddleware``: ::

MIDDLEWARE_CLASSES = (
'django.middleware.cache.UpdateCacheMiddleware',
'hmin.middleware.MinMiddleware',
# other middleware classes
'django.middleware.cache.FetchFromCacheMiddleware',
'hmin.middleware.MarkMiddleware',
)

You can optionally specify the ``HTML_MINIFY`` setting::

HTML_MINIFY = True

The default value for the ``HTML_MINIFY`` setting is ``not DEBUG``. You only
need to set it to ``True`` if you want to minify your HTML code when ``DEBUG``
is enabled.


License
===================
Who cares? Use it whatever you want.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for django-hmin, version 0.1
Filename, size File type Python version Upload date Hashes
Filename, size django-hmin-0.1.tar.gz (2.2 kB) File type Source Python version None Upload date Hashes View

Supported by

Pingdom Pingdom Monitoring Google Google Object Storage and Download Analytics Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page