/connect-nunjucks

Nunjucks middleware for connect / express

Primary LanguageJavaScript

connect-nunjucks

this middleware is based on the browser-sync-nunjucks package.

nunjucks works with expressjs out of the box, but we wanted to use the module as a middleware for browser-sync - so here you go.

Example use

var nunjucksMiddleware = require('connect-nunjucks');

express.use(
  nunjucksMiddleware({
    baseDir: 'src',
    // default extension if non is supplied
    ext: '.html',
    // possible debug values: true, false, 'browser', 'console'
    debug: true,
    // custom nunjuck filters
    filters: require('./custom-filters'),
    context: {
      dataInTemplates: {
        value1: 'whatever'
      }
    }
  })
);