Skip to content

Instantly share code, notes, and snippets.

@chodorowicz
Created July 27, 2016 13:52
Show Gist options
  • Save chodorowicz/2bd802661d1b4ccf53c11a8ae9f000c3 to your computer and use it in GitHub Desktop.
Save chodorowicz/2bd802661d1b4ccf53c11a8ae9f000c3 to your computer and use it in GitHub Desktop.
nunjucks
const express = require('express');
const nunjucks = require('nunjucks');
const app = express();
const nunjucksConfig = {
autoescape: true,
express: app
};
/** path to templatesconfig object */
nunjucks.configure('templates', nunjucksConfig);
app.get('/', function(req, res) {
const config = {};
res.render('index.nunjucks', {
config: JSON.stringify(config),
});
});
/**
* don't cache and watch in dev
**/
nunjucksConfig = {
noCache: true,
watch: true
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment