django-libsass
A django-compressor filter to compile SASS files using libsass
What it is and what it does
django-libsass bridges Django's static asset pipeline with Sass compilation by providing a django-compressor filter that uses libsass (a C/C++ port of the Sass engine) to compile SCSS files to CSS. It resolves relative paths and consults Django's STATICFILES_FINDERS, allowing imports across app boundaries, and provides a built-in static() function for generating URLs to static resources within Sass.
The package avoids external executable dependencies by calling libsass directly through Python bindings, making it faster and simpler to deploy than shell-based Sass compilers. It supports configurable output styles (nested, expanded, compact, compressed), source comments, sourcemaps, and custom functions, with sensible defaults tied to Django's DEBUG setting.
Use it for:
- Compile SCSS stylesheets to CSS during Django's asset collection phase without external build tools.
- Import Sass files across multiple Django apps using Django's static file discovery mechanism.
- Generate static asset URLs within Sass using the built-in static() function, keeping asset paths in sync with Django's configuration.
- Enable source comments and sourcemaps in development (DEBUG=True) for easier stylesheet debugging.
- Use custom Python functions within Sass templates to compute values or generate dynamic CSS.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Integrates Sass compilation into Django projects via django-compressor, using libsass to compile SCSS files to CSS during the asset pipeline.
Yes, if you are using django-compressor and need Sass compilation without external build dependencies. The low install friction, permissive license, and lack of known vulnerabilities make it safe to adopt. However, the dormant maintenance status (last release 2021-07-08) means you should verify compatibility with your Django and libsass versions before committing, and be prepared to maintain a fork if critical issues arise.
Install
django-libsass on PyPI
pip
pip install django-libsassuv
uv add django-libsasspoetry
poetry add django-libsassInstalling django-libsass
Before you install
Low install friction with a pure-pip dependency chain (django-compressor, libsass, django-appconf). Maintenance is dormant—last release was 2021-07-08, though the repository remains active with a recent commit in 2024-11-22.
License in practice
BSD license (permissive) places no significant restrictions on use, modification, or distribution in most contexts.
Quickstart
pip install django-libsass
# In Django settings.py:
COMPRESS_PRECOMPILERS = (
('text/x-scss', 'django_libsass.SassCompiler'),
)
# In template:
{% load compress %}
{% compress css %}
<link rel="stylesheet" href="{% static 'style.scss' %}" type="text/x-scss">
{% endcompress %}
Requires django-compressor to be installed and configured in your Django project.
Verify before relying
- Compatibility with Django versions released after 3.9 (classifiers stop at 3.9, latest release 2021-07-08).
- Whether libsass version constraints or C/C++ build dependencies affect installation on all platforms.
- Current status of libsass bindings and whether they remain maintained.
Package facts
| License | BSD (permissive) |
| Python support | not specified |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 3 — django-compressor, libsass, django-appconf |
| Maintenance | dormant — 1,863 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 1,035,917/month — #4,461 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: django_libsass-0.9-py3-none-any.whl
Tags
More Dynamic Content packages
MarkupSafe provides a text object that escapes…
permissive · top 100 on PyPI
Jinja2Jinja2 is a templating engine that renders…
permissive · top 100 on PyPI
soupsieveSoupsieve is a CSS selector library designed to…
permissive · top 100 on PyPI
WerkzeugWerkzeug is a WSGI utility library providing…
permissive · top 1,000 on PyPI
FlaskFlask is a lightweight WSGI web application…
permissive · top 1,000 on PyPI
MakoMako compiles Python-embedded templates into…
permissive · top 1,000 on PyPI
django-sass-processorCompiles SASS/SCSS files to CSS on the fly…
permissive · top 15,000 on PyPI
libsassCompiles Sass and SCSS stylesheets to CSS…
permissive · top 5,000 on PyPI
django-compressorDjango Compressor combines, minifies, and…
permissive · top 5,000 on PyPI
django-pipelinedjango-pipeline bundles and compresses CSS and…
permissive · top 15,000 on PyPI
pyScssCompiles Sass/SCSS stylesheets to CSS,…
permissive · top 15,000 on PyPI
Flask-AssetsIntegrates asset management into Flask…
permissive · top 15,000 on PyPI
webassetsMerges and compresses JavaScript and CSS files…
permissive · top 15,000 on PyPI
djangocms-admin-styleProvides styled CSS templates and admin…
permissive · top 15,000 on PyPI
csscompressorCompresses CSS by removing unnecessary…
permissive · top 5,000 on PyPI