2.1.0 • Published 7 years ago

fly-nunjucks-render v2.1.0

Weekly downloads
3
License
MIT
Repository
github
Last release
7 years ago

fly-nunjucks-render

Render Nunjucks templates with Fly.

Issues with the output should be reported on the Nunjucks issue tracker.

Install

npm install --save-dev fly-nunjucks-render

Usage

exports.views = function * (fly) {
  yield fly.source('src/*.html')
    .nunjucks({
      base: 'src/partials',
      data: {name: 'Luke Edwards'},
      // or
      dataPath: 'src/path/to/data.json'
    })
    .target('dist');
}
<!-- src/index.html -->
<p>Hello, {{ name }}!</p>

API

.nunjucks(options)

Multiple configuration options for Nunjucks are available.

Important: Please do not attempt to use the watch option. Instead, use fly.watch().

See below for additional options specific to fly-nunjucks-render.

options.base

Type: string Default: .

Specify the location of your templates. Without this, Nunjucks will not be able to reliably compile or find your partials.

options.data

Type: object Default: {}

Context data that is passed to your templates. Optional

option.dataPath

Type: string Default: ''

Similar to options.data, but is a path to an external file. Useful for large datasets. Optional

License

MIT © Luke Edwards

2.1.0

7 years ago

2.0.0

8 years ago

1.0.0

8 years ago

0.0.0

8 years ago