Mustache template engine for express 3.x. Support partials and layout
CoffeeScript JavaScript
Switch branches/tags
Nothing to show
Pull request Compare This branch is 39 commits behind vol4ok:master.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
example
.gitignore
.npmignore
MIT-LICENSE
README.md
hogan-express.coffee
hogan-express.js
package.json

README.md

HOGAN-EXPRESS

Mustache template engine for express 3.x.

Use twitter's hogan.js engine.

Supports

  • partials
  • layout
  • caching

Install

npm install hogan-express

Usage

Setup:

app.set('view engine', 'html')
app.set('layout', 'layout') # rendering by default
app.set('partials', head: "head") # partails using by default on all pages
app.enable('view cache')
app.engine 'html', require('hogan-express')

Rendering template:

app.get '/', (req,res)->
  res.locals = what: 'World'
  res.render "index", partials: {temp: 'temp'}

(will render layout.html with index.html, head.html and temp.html partials)

{{{ yield }}} variable in template means the place where your page are rendered inside the layout.

For render page with custom layout, just specify it in options res.render "admin.html", layout: "admin-layout"

License

MIT License