Nunjucks notes

https://nunjucks.bootcss.com/getting-started.html

 

1. installation

npm install nunjucks

 

2. use

nunjucks from Import 'nunjucks' ; 

var App = Express (); 

nunjucks.configure ( 'views' , { 
    autoescape: to true , 
    Express: App 
}); 
// node at the end, 'views' relative to the current working directory (working directory) of path. On the browser side, compared with a relative url, it is preferably specified as an absolute path (e.g.,  '/views'). app.get (
'/', function (REQ, RES) { res.render ( 'index.html' ); });

 

Guess you like

Origin www.cnblogs.com/flyerya/p/11432420.html