wintersmith-nunjucka

0.8.1 • Public • Published

wintersmith-nunjucka

A new nunjucks plugin for wintersmith

Forked from wintersmith-nunjucks.

How to use

  1. Install globally using npm: npm install -g wintersmith-nunjucka
  2. Add to your wintersmith config.json: "plugins": ["wintersmith-nunjucka"]
  3. Create nunjucks templates ending in .html

How to add custom filters

From the nunjucks documentation at https://mozilla.github.io/nunjucks/templating.html#filters:

Filters are essentially functions that can be applied to variables. They are called with a pipe operator (|) and can take arguments.

For more information on how to write customer Filters, take a look at the API documentation page at: http://mozilla.github.io/nunjucks/api#Registering-custom-filters

To use customer filters with wintersmith, put the filter in its own file stored in a filters directory. The filename has to be the name of the filter + '.js'.

so if your filter is in './filters/myfirstfilter.js' add a nunjucks section like this to your config.json:

"nunjucks": {  
    "filterdir": "filters",
    "filters": ["myfirstfilter"]
}

OR

"nunjucks": {  
    "filterfile": "nunjucks.filters.js"
}

It will be available in your templates at 'myfirstfilter'

Package Sidebar

Install

npm i wintersmith-nunjucka

Weekly Downloads

0

Version

0.8.1

License

BSD

Last publish

Collaborators

  • waynebloss