Nunjucks笔记

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

1。 安装

npm install nunjucks

2。使用

import nunjucks from 'nunjucks';

var app = express();

nunjucks.configure('views', {
    autoescape: true,
    express: app
}); 
//在 node 端,'views' 为相对于当前工作目录 (working directory) 的路径。在浏览器端则为一个相对的 url,最好指定为绝对路径 (如 '/views')。 app.get(
'/', function(req, res) { res.render('index.html'); });

猜你喜欢

转载自www.cnblogs.com/flyerya/p/11432420.html