bohde / django-cafe

Serve Coffeescript from your Django templates
16 stars 1 forks source link

Django Cafe

Django cafe is a way to integrate Coffeescript within your Django application.

Simple Example

{% load coffee %}
<script src="https://github.com/bohde/django-cafe/raw/master/{% coffee spam.coffee %}"/>

Multiple Files

<script src="https://github.com/bohde/django-cafe/raw/master/{% coffee foo.coffee bar.coffee %}"/>

Install

`pip install https://github.com/joshbohde/django-cafe/tarball/master`

Setup

Make sure cafe is in your installed app, like so. You'll also need to have a working installation of Coffeescript.

INSTALLED_APPS = (
  ...
  "cafe", 
  ...      
) 

Settings

CAFE_ROOT

Default: MEDIA_ROOT

The location of the .coffee files.

CAFE_OUTPUT_DIR

Default: compiled

The location within the CAFE_ROOT to store the compiled .js files.

COFFEE_BIN

Default: "coffee"

The Coffeescript executable.

COFFEE_PARAMS

Default: "-cj"

The parameters sent to the Coffeescript compiler.