我正在尝试从jade中包含的html文件访问jade变量。例如......
路线:
router.get('/htmltest', function(req, res, next) {
res.render('htmltest', { title: 'HTML TEST' });
});
玉:
block content
include htmltest.html
htmltest.html:
<p>This is included html #{title}</p>
标题不会以html格式显示。我想我有一个范围问题。有关如何实现这一目标的任何想法?
答案 0 :(得分:1)
jade中以开括号<
开头的每一行都被视为单个文本字符串。您需要将htmltest.html文件更改为...
p This is included html #{title}