Last active
January 30, 2016 16:43
Nunjucks 2.3.0 + Express 4.13.4
This file contains hidden or 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
var nunjucks = require('nunjucks') | |
, express = require('express') | |
, app = express() | |
, env | |
; | |
// view engine setup | |
app.set('views', path.join(__dirname, 'views')); | |
env = new nunjucks.Environment( | |
new nunjucks.FileSystemLoader(app.get('views')) | |
, { autoescape: true } | |
); | |
// add filters to env example | |
env.addFilter('asset', function(assetpath) { | |
var asset_url = "path/to/assets/"; | |
return asset_url + assetpath; | |
return assetpath; | |
}); | |
env.express(app); | |
app.set('view engine', 'nunjs'); // lets make our extension shorter. | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment