{"id":8114,"library":"django-sass-processor","title":"Django SASS Processor","description":"Django SASS Processor compiles SCSS files into CSS dynamically during development or offline for production. It integrates seamlessly with Django's staticfiles system and provides template tags for easy inclusion of compiled CSS in templates. The current version is 1.4.2, with minor releases occurring every few months, and major versions (like 1.0.0) introducing breaking changes less frequently.","status":"active","version":"1.4.2","language":"en","source_language":"en","source_url":"https://github.com/jrief/django-sass-processor","tags":["django","sass","scss","frontend","compilation","staticfiles"],"install":[{"cmd":"pip install django-sass-processor","lang":"bash","label":"Install stable version"}],"dependencies":[{"reason":"Required for SCSS compilation. This package itself often requires a C/C++ compiler to build.","package":"libsass-python","optional":false}],"imports":[{"note":"Used in STATICFILES_FINDERS configuration.","symbol":"CssFinder","correct":"from sass_processor.finders import CssFinder"}],"quickstart":{"code":"import os\n\n# settings.py snippet\n\nINSTALLED_APPS = [\n    # ... other Django apps\n    'django.contrib.staticfiles',\n    'sass_processor',\n]\n\nSTATIC_URL = '/static/'\nSTATIC_ROOT = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'staticfiles')\n\n# Define where your SCSS files are located\nSASS_PROCESSOR_ROOT = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'sass')\n\n# Example template (e.g., templates/base.html)\n# Make sure to create a directory 'sass' in your project root\n# and add an example.scss file: sass/example.scss\n# body {\n#   color: blue;\n# }\n\n# To test, create a file named 'example.scss' in the SASS_PROCESSOR_ROOT directory:\n# $body-color: blue;\n# body {\n#   color: $body-color;\n# }","lang":"python","description":"Configure `django-sass-processor` by adding it to `INSTALLED_APPS` and defining `SASS_PROCESSOR_ROOT`. Then, load the `sass_tags` in your templates to reference your compiled SCSS files. Remember to run `python manage.py collectstatic` in production."},"warnings":[{"fix":"Update any scripts or commands that use `manage.py compilescss --use-processor-root` to `manage.py compilescss --use-storage`.","message":"In version 1.0.0, the `compilescss` management command's argument `--use-processor-root` was removed and replaced with `--use-storage`.","severity":"breaking","affected_versions":">=1.0.0"},{"fix":"If you were using `SassS3Boto3Storage`, switch to using `S3Boto3Storage` directly from `django-storages` in your `STATICFILES_STORAGE` setting.","message":"In version 1.0.0, `SassS3Boto3Storage` was removed. It is no longer needed as `django-sass-processor` now works directly with standard `S3Boto3Storage` from `django-storages`.","severity":"breaking","affected_versions":">=1.0.0"},{"fix":"Ensure you have build tools installed: On Debian/Ubuntu, `sudo apt-get install build-essential`. On macOS, `xcode-select --install`. On Windows, install Visual C++ Build Tools (part of Visual Studio installer) or use WSL.","message":"Installation of `libsass-python` (a core dependency) often fails if a C/C++ compiler is not available on your system, leading to `error: Failed building wheel for libsass-python`.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Ensure `SASS_PROCESSOR_ENABLED = True` (default in DEBUG mode). Clear your browser cache. For persistent issues, manually force recompilation by running `python manage.py compilescss --force`.","message":"During development (`DEBUG=True`), changes to SCSS files may not immediately reflect in the browser due to caching or the processor not detecting file changes.","severity":"gotcha","affected_versions":"All versions"}],"env_vars":null,"last_verified":"2026-04-16T00:00:00.000Z","next_check":"2026-07-15T00:00:00.000Z","problems":[{"fix":"Install the library: `pip install django-sass-processor`. If already installed, ensure your virtual environment is active.","cause":"`django-sass-processor` is not installed or not properly configured in your Python environment.","error":"ModuleNotFoundError: No module named 'sass_processor'"},{"fix":"Add `'sass_processor'` to your `INSTALLED_APPS` list in `settings.py`.","cause":"The `sass_processor` app is missing from your Django project's `INSTALLED_APPS` setting.","error":"django.template.library.InvalidTemplateLibrary: 'sass_processor' is not a registered tag library"},{"fix":"Install the necessary build tools for your operating system (e.g., `build-essential` on Linux, Xcode Command Line Tools on macOS, Visual C++ Build Tools on Windows).","cause":"The underlying `libsass-python` dependency requires a C/C++ compiler to build, which is not found on your system.","error":"libsass-python: C compiler cannot create executables"},{"fix":"Set `SASS_PROCESSOR_ROOT` in `settings.py` to the absolute path of the directory containing your SCSS files (e.g., `os.path.join(BASE_DIR, 'sass')`).","cause":"The `SASS_PROCESSOR_ROOT` setting is not configured, or points to an invalid directory, preventing `django-sass-processor` from finding your SCSS files.","error":"The path to the SASS files is not defined."}]}