npm stats
  • Search
  • About
  • Repo
  • Sponsor
  • more
    • Search
    • About
    • Repo
    • Sponsor

Made by Antonio Ramirez

fly-nunjucks-render

2.1.0

@lukeed

npmHomeRepoSnykSocket
Downloads:148
$ npm install fly-nunjucks-render
DailyWeeklyMonthlyYearly

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