我有一组HTML文件,大多是静态的,我想移动到我的node.js/express/jade项目中。如何在jade中直接包含HTML文件或片段?我不想将现有的HTML文件转换为jade。
在jade中,将精确的html代码或片段放在:verbatim
标签之间。
doctype html
html(lang="en")
:verbatim
{% include head.html %}
body
:verbatim
{{ content }}
:verbatim
{% include footer.html %}
输出
<!DOCTYPE html>
<html lang="en">{% include head.html %}
<body>{{ content }}
</body>{% include footer.html %}
</html>
在我的.jade文件中,我需要做这样的事情:
:verbatim
!{editorBody}
..其中editorBody是通过res.render()调用提供的:
var editorBody = '<p>Hello</p>';
return res.render('user/user_profile', {editorBody : editorBody});
include
? - Old Geezer