tabloid

0.0.3 • Public • Published

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 (via Accept: 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.

Readme

Keywords

Package Sidebar

Install

npm i tabloid

Weekly Downloads

3

Version

0.0.3

License

MIT

Last publish

Collaborators

  • nucky