Created
July 27, 2016 13:52
-
-
Save chodorowicz/2bd802661d1b4ccf53c11a8ae9f000c3 to your computer and use it in GitHub Desktop.
nunjucks
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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