django-compass is a port of Compass for use in Django 1.3+ projects. It's a simple app containing static files for Compass and the Susy framework. Requires a sass compiler like django-css to be useful.
- You have a sass compiler installed
- You store your css in settings.STATICFILE_ROOT + 'css/'
- You store your sass in settings.STATICFILE_ROOT + 'css/sass/'
-
Add 'compass' to INSTALLED_APPS
-
Make sure your have configured django.contrib.staticfiles in your settings
import os here = lambda x: os.path.join(os.path.abspath(os.path.dirname(__file__)), x) STATICFILES_ROOT = here('static') STATICFILES_FINDERS = ( "django.contrib.staticfiles.finders.FileSystemFinder", "django.contrib.staticfiles.finders.AppDirectoriesFinder",)
-
Run ./manage.py collectstatic
-
Compile your SASS with something like django-css
Create a base sass file in your /static/css directory. We'll use full.sass
as an example. It should look something like this
@import "sass/compass"
@import "sass/frameworks/susy"
body
@include susy
This will load up Compass, the Susy framework, and initialize Susy on the body element