Compresses linked and inline javascript or CSS into a single cached file.

Overview

Django Compressor

https://codecov.io/github/django-compressor/django-compressor/coverage.svg?branch=develop Build Status

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.

Django Compressor is compatible with Django 1.11 and newer.

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, the 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

Photonix Photo Manager - a photo management application based on web technologies

A modern, web-based photo management server. Run it on your home server and it will let you find the right photo from your collection on any device. Smart filtering is made possible by object recogni

Photonix Photo Manager 1.5k Jan 01, 2023
Pipeline is an asset packaging library for Django.

Pipeline Pipeline is an asset packaging library for Django, providing both CSS and JavaScript concatenation and compression, built-in JavaScript templ

Jazzband 1.4k Dec 26, 2022
Peak.py - An awesome tool to keep you up about servers and websites status

An In-house API Powered GUI App To Check Server Stats, Generate Logs And More Features To Be Added Soon.

3 Feb 24, 2022
Manage your activities as well as possible.

ToDo-List Manage your activities as well as possible. Create workspace Create many boards for different topics Add unlimited tasks About me Full name:

Matin Ardestani 10 Sep 11, 2022
Compresses linked and inline javascript or CSS into a single cached file.

Django Compressor Django Compressor processes, combines and minifies linked and inline Javascript or CSS in a Django template into cacheable static fi

2.6k Jan 03, 2023
A faster collectstatic command.

Collectfast A faster collectstatic command. Features Efficiently decide what files to upload using cached checksums Parallel file uploads Supported St

Anton Agestam 405 Dec 27, 2022
https://django-storages.readthedocs.io/

Installation Installing from PyPI is as easy as doing: pip install django-storages If you'd prefer to install from source (maybe there is a bugfix in

Josh Schneier 2.3k Jan 05, 2023
Asset management for Python web development.

Asset management application for Python web development - use it to merge and compress your JavaScript and CSS files. Documentation: https://webassets

Michael Elsdörfer 912 Dec 25, 2022
Transparently use webpack with django

django-webpack-loader Read http://owaislone.org/blog/webpack-plus-reactjs-and-django/ for a detailed step by step guide on setting up webpack with dja

2.4k Jan 06, 2023
HTML minifier for Python frameworks (not only Django, despite the name).

django-htmlmin django-html is an HTML minifier for Python, with full support for HTML 5. It supports Django, Flask and many other Python web framework

Cobra Team 536 Dec 25, 2022
django-systemjs

Django SystemJS Django SystemJS brings the Javascript of tomorrow to Django, today. It leverages JSPM (https://jspm.io) to do the heavy lifting for yo

Sergei Maertens 42 Jan 11, 2022
Compresses linked and inline javascript or CSS into a single cached file.

Django Compressor Django Compressor processes, combines and minifies linked and inline Javascript or CSS in a Django template into cacheable static fi

2.6k Jan 03, 2023
A django compressor tool that bundles css, js files to a single css, js file with webpack and updates your html files with respective css, js file path.

django-webpacker's documentation: Introduction: django-webpacker is a django compressor tool which bundles css, js files to a single css, js file with

MicroPyramid 72 Aug 18, 2022
Python bindings to webpack

Unmaintained This project is unmaintained as it's a complicated solution to a simple problem. You should try using either https://github.com/owais/dja

Mark Finger 62 Apr 15, 2022