Nominally Patriotic Meathead
Learn about our RFC process, Open RFC meetings & more.Join in the discussion! »

nunjucks-filters

1.4.2 • Public • Published

nunjucks-filters

Build Status Code Climate

Nunjucks environment and filters

Installation

npm install --save nunjucks-filters

Usage

Simply require it in your app.js file

var app = require('express')(),
  nunjucks = require('nunjucks-filters')();
 
app.engine('nunjucks', nunjucks);

Passing env in

If you want to configure and use your own nunjucks environment, you can pass it through

var nunjucks = require('nunjucks'),
  env = nunjucks.configure('.', { custom: 'options' }),
  filters = require('nunjucks-filters');
 
filters(env);

Getting env out

Nunjucks-filters returns its nunjucks environment (including any env passed into it), so you can easily add your own filters and globals.

var env = require('nunjucks-filters')();
 
// add a filter
env.addFilter('emoji', function () {
  return '(⌐■_■)';
});
 
// add a global
env.addGlobal('coolDude', 'Nelson Pecora');

Install

npm i nunjucks-filters

DownloadsWeekly Downloads

85

Version

1.4.2

License

MIT

Last publish

Collaborators

  • avatar
  • avatar
  • avatar
  • avatar
  • avatar
  • avatar
  • avatar
  • avatar
  • avatar
  • avatar
  • avatar
  • avatar
  • avatar
  • avatar
  • avatar
  • avatar