Django Static Precompiler provides template tags and filters to compile CoffeeScript, LiveScript, SASS / SCSS, LESS, Stylus, Babel and Handlebars. It works with both inline code and external files.
Clone or download
Latest commit bcf8c78 Mar 14, 2018
Permalink
Failed to load latest commit information.
.circleci Use pre-built docker image for development and CI Feb 10, 2018
docs Release 1.8.2 Mar 14, 2018
static_precompiler Release 1.8.2 Mar 14, 2018
test_project fixed flake error Mar 8, 2015
.codeclimate.yml Exclude `south_migrations` from CodeClimate analysis Sep 9, 2015
.coveragerc Fix `.coveragerc` and pin coverage version Sep 20, 2015
.dockerignore Ignore `.pytest_cache` Mar 3, 2018
.gitignore Ignore `.pytest_cache` Mar 3, 2018
.isort.cfg isort with line length 120 Sep 20, 2015
AUTHORS Update the change log and the contributors list Mar 14, 2018
CHANGES.rst Fix URL converter to properly handle `url(..)` not followed directly … Mar 14, 2018
Dockerfile Use pre-built docker image for development and CI Feb 10, 2018
Dockerfile-base Use pre-built docker image for development and CI Feb 10, 2018
LICENSE Release 0.1 Oct 30, 2013
MANIFEST.in Fix `MANIFEST.in` to exclude `.sass-cache` from distribution. Mar 7, 2015
Makefile Add Makefile Mar 1, 2018
README.rst Restructure docs Mar 3, 2018
docker-compose.yml Replace `python`, `test` and `tox` services with generic `app` servic… Feb 4, 2017
requirements-ci.txt Switch to CircleCI 2.0 May 24, 2017
requirements-dev.txt Move dev/tests requirements to `requirements-*.txt` May 24, 2017
requirements-test.txt Move dev/tests requirements to `requirements-*.txt` May 24, 2017
setup.cfg Ignore `.venv` and `.tox` Mar 1, 2018
setup.py Fix `setup.py` to add compatibility with Python 3.4 and below. Mar 6, 2018
tox.ini Added django 2.0 to tox.ini. Dec 4, 2017

README.rst

Django Static Precompiler

Django Static Precompiler provides template tags and filters to compile CoffeeScript, LiveScript, SASS / SCSS, LESS, Stylus, Babel and Handlebars. It works with both inline code and external files.

Build Status Code Coverage Code Climate Documentation Gitter

Documentation

Documentation is available at http://django-static-precompiler.readthedocs.io.

Install

pip install django-static-precompiler

Use in templates

{% load compile_static %}
{% load static %}

<script src="{% static "path/to/script.coffee"|compile %}"></script>
<link rel="stylesheet" href="{% static "path/to/styles1.less"|compile %}" />
<link rel="stylesheet" href="{% static "path/to/styles2.scss"|compile %}" />

Use in Python

>>> from static_precompiler.utils import compile_static
>>> compile_static("styles.scss")
"COMPILED/styles.css"

Django compatibility

django-static-precompiler Django
version 2.0 1.11 1.10 1.9 1.8 1.7 1.6
1.7+ + + + + + +  
1.6   + + + + +  
1.5     + + + + +
1.1-1.4       + + + +
1.0           + +