1 of 9

Civet: A Django Plug-In for Faster CoffeeScript/Sass Development

Lukhnos Liu (lukhnos@lukhnos.org)

August 13, 2014

2 of 9

Background

  • I work at Counsyl
  • We use Python & Django
  • CoffeeScript + Sass, too
  • .scss/.coffee requires extra setup
  • Idea: let runserver take care of them?

3 of 9

Introducing Civet

https://github.com/counsyl/civet

4 of 9

5 of 9

Using Civet

  • pip install civet
  • In your settings.py:

INSTALLED_APPS = (

'django.contrib.staticfiles',

'civet',

...)

  • Specify where you want to save the assets:

CIVET_PRECOMPILED_ASSET_DIR = '/tmp/some_assets'

  • manage.py runserver

6 of 9

7 of 9

Under the Hood

  • Use django.contrib.staticfiles.finder
  • Pass directories to sass
  • Use watchdog for CoffeeScript
    • Works with Django file layout
    • Avoids problem with FSWatcher on OS X
  • Also massages source maps!
    • Easier to debug with .coffee code

8 of 9

Comparisons

  • grunt, gulp, etc.
  • Civet is “Django-native”
    • Drop in Civet, start using CoffeeScript/Sass
  • Not a packaging tool

9 of 9

https://github.com/counsyl/civet