Skip to main content

Django Sass Finder

A static files finder for Django that compiles Sass files

Installation

WARNING: MAKE SURE YOU HAVE NO SASS PACKAGES INSTALLED (other than libsass)!

Run pip install django_sass_finder to add this module to your virtualenv, then add the finder to the list your static file finders as follows:

STATICFILES_FINDERS = [
    # add the default Django finders as this setting will override the default
    'django.contrib.staticfiles.finders.FileSystemFinder',
    'django.contrib.staticfiles.finders.AppDirectoriesFinder',
    # our finder
    'django_sass_finder.finders.ScssFinder',
]

There is no need to add django_sass_finder into settings.INSTALLED_APPS.

The following additional (with examples) settings are used and required by this staticfiles finder:

BASE_DIR = ...

SCSS_ROOT = BASE_DIR / 'scss'   # where the .scss files are sourced
SCSS_COMPILE = [                # a list of filename pattern to search for within SCSS_ROOT
    'site.scss',                # default is **/*,css (all scss source files in and below SCSS_ROOT)                                                                                                                                                                                                                                                                                            
    'admin/admin.scss',
]
SCSS_INCLUDE_PATHS = [          # optional: scss compiler include paths (default = empty)
    BASE_DIR / 'node_modules'
]
CSS_STYLE = 'compressed'            # optional: output format 'nested', 'expanded','compact','compressed'
CSS_MAP = True                      # optional: generate a source map
CSS_COMPILE_DIR = BASE_DIR / 'static' / 'css'   # The target directories for the compiled .css
STATICFILES_ROOT = [                            # this should be at or above the CSS_COMPILE_DIR
    BASE_DIR / 'static'                         # but targetting {app}/static should also work
]

BASE_DIR and variants above are pathlib.Path objects, but path strings can also be used.

Usage

This module dynamically compiles to target .css files, and recompiles them on demand whenever they are updated.

The collectstatic management command compiles these, and lets the FilesystemFinder transfer them to STATIC_ROOT. The development server is perfectly able to serve these from STATICFILES_ROOT without the need to collectstatic.

License

This package is licensed under the MIT license.

Metadata

Release files for django-sass-finder 2.0.7

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for django-sass-finder 2.0.7
File Size Uploaded
django-sass-finder-2.0.7.tar.gz 5.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for django-sass-finder 2.0.7
File Interpreter ABI Platform
django_sass_finder-2.0.7-py3-none-any.whl Python 3 none any Details

Total release size: 10.9 kB

Release files / django-sass-finder-2.0.7.tar.gz

Download URL django-sass-finder-2.0.7.tar.gz
Size 5.4 kB
Tags Source
SHA-256 checksum
How to use checksums
8b4301cc331a99928229cd3ce9f9f531eeca44f6ec1ebe89aaf08599d4035654
BLAKE2b-256 checksum
How to use checksums
16db31d58e34cfe58a8dc1229d6949092014c6b48a65aeaa0df8363cf498800e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.1.8 CPython/3.9.1 Windows/10

Release files / django_sass_finder-2.0.7-py3-none-any.whl

Download URL django_sass_finder-2.0.7-py3-none-any.whl
Size 5.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
5fc14bdbfa23a5f3ff2f5fe8eb0b777910fecd64644f339f6eac724981515283
BLAKE2b-256 checksum
How to use checksums
94c4199b2fcd6039e2057c23dcd9f151b79e22a74a6178e744a616a060dfcd5b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.1.8 CPython/3.9.1 Windows/10

Release history Release notifications | RSS feed

This release

2.0.7 This release

2 release files

2.0.6

2 release files

1.0.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page