Django and compass with multiple applications

I want to use Compass to simplify the task of writing CSS in my Django application. But I do not know how to configure it.

I see that django-compressor supports SASS, but to use Compass I needed to dump _*.scss into my workspace (Django 1.4), since the working directory when django-compressor runs scss .

Eric Mayer 's approach sounds reasonable (compile .scss files to .css during development and pass SCM), but it’s not obvious how I can use SASS / Compass tools to compile .scss in several applications (both reusable and unused) in Django workspace.

I store static style sheet files for each application in <app>/static/<app>/css/ .

I have the following questions:

  • @import does not work in applications
  • Placing _*.scss on the workspace is unacceptable
  • Running compass watch in the workspace fails:

    Do not compile anything. If you are trying to start a new project, you have left the directory argument.

  • Using @include background(...) fails:

    Syntax error: Undefined operation: "-compass-list-size (compact (#cccccc, false, false, false, false, false, false, false, false, false)) gt"

+7
source share
2 answers

It was much easier for me to substantially separate Django from Sass. You can use them at the same time, but this may require a different terminal window. In the end, it is all about servicing compiled assets.

Usually I set up my project using the / src / directory in the root, where I place the Sass files. I also created a Compass project in this root directory with compiled style sheets that go into / static / css /.

Obviously, this can become problematic if there are many applications in the project, since you want to create application directories in the root / static / or create another Compass project in /

I usually use Grunt to compile my Sass / Compass files, so it is a bit more complicated, although it is easy to recreate.

The Frank Wiles Ultimate Front End Development Setup post is pretty close to how I set up my projects, although I skip using the django compressor, how I feel adding middleware is not required, and obviously I'm using Grunt instead of Gulp.

+1
source

Perhaps you can use a tool like Fabric (or even a bash script) to handle compiling and placing files. As for the compass watch , you may need to manually specify additional parameters for the location of the .scss and .css files to successfully execute its watch ( check the help documents by running compass help watch ).

0
source

All Articles