tabloid
v0.0.3
Published
A Connect middleware that renders JSON or Jade templates.
Downloads
2
Readme
Tabloid
Simple Jade and/or JSON renderer middleware for connect.
Just
tabloid = require('tabloid');
...
app.use(tabloid.renderContent("views/main.jade"))
app.use(tabloid.renderError("views/error.jade"))
renderContent
and renderError
take :
- An optionnal global object. The name isn't related to its scope. Tabloid will just include this object as the
globals
variable in the template. - An optionnal boolean argument. When set to
true
, it allows JSON send if the client browser asks it (viaAccept: application/json
).
Which yields tabloid.renderContent(template file name [, globals [, json]])
or tabloid.renderError(template file name [, globals [, json]])
While renderContent
uses res.locals
as Jade locals, renderError
uses the err
parameter. globals
are accessibles in the template via globals.global
. Note that both JSON renderer do not include globals
.