jade-renderer

0.0.4 • Public • Published

Build Status

Render batches of jade templates, with custom options, data and locals.

Install

npm install jade-renderer

Usage

var render = require('jade-renderer')

render(pages, options, cb)

  • pages an array of 'pages' to render. 'pages' look like this:
{ template: 'path/to/template'
, data:
  { text: 'some arbitrary data'
  , more: 'to pass to the template'
  , fn: function () {
      return 'may contain any js, including functions'
    }
  }
}
  • options is an options hash
    • src the source directory, defaults to PWD
    • dest the destination directory, defaults to PWD
    • locals locals to be passed to all views that are rendered (useful for view helpers)
  • cb is the callback function (err) {} (err is null if ok)

Eg:

render(
    [ { template: 'index', data: { title: 'Index'} }
    , { template: 'about', data: { title: 'About'} }
    ]
  , { src: __dirname
    , dest: __dirname + '/html/'
    }
  , function (err) {
    if (err) throw err
    console.log('done!')
  })

Readme

Keywords

none

Package Sidebar

Install

npm i jade-renderer

Weekly Downloads

1

Version

0.0.4

License

BSD

Last publish

Collaborators

  • bengourley