viatropos/mint.js — pull request #5 by vdemedes (2012-05-16 07:43:19+00:00)
Title: Added ability to compile templates

Mint now has only ability to render templates instantly, but **compile** is much more useful. It allows to parse templates into functions and execute them with different values/params later, which leads to faster template rendering. There is no need to read template's file or store it somewhere in that case. Just function.

**Note**: compile method supports only jade, haml, handlebars, eco and ejs now.

Example:

```coffee-script
mint = require 'mint'

ecoTemplate = 'Hello, <%= @name %>' # just to skip fs.readFile, for example

template = mint.compile engine: 'eco', template: ecoTemplate # Function

template( name: 'Vadim' ) # "Hello, Vadim"
template( name: 'Joe' ) # Hello, Joe
```