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.
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'
}
}
})
);