Express3 usage

malgorithms edited this page Oct 25, 2012 · 4 revisions


If you haven't yet, install the toffee module:

> npm install -g toffee

Using it

In Express 3.x to make it your default engine:

app.set 'view engine', 'toffee'

In Express 3.x to use it just for .toffee files:

toffee = require 'toffee'
app.engine 'toffee', toffee.__express

Using a "layout", the Express 2 way.

Yes, this works. If you publish a file foo.toffee and pass a layout filename to it as a var, foo.toffee is rendered, and the results are put into a var called body.

Inside your layout file, to print the body, do this:

#{raw body}

See Also