node.js - 有没有办法直接在 Jade 中包含 html 文件或片段?

标签 node.js pug

我有一组 html 文件,大部分是静态的,我想移动到我的 node.js/express/jade 项目。直接在 Jade 中包含 html 文件或片段的正确方法是什么?我不想将现有的 html 文件翻译成 Jade ?

最佳答案

您应该能够简单地 include it在 Jade 模板内:

As mentioned include can be used to include other content such as html or css. By providing an extension, Jade will read that file in, apply any filter matching the file's extension, and insert that content into the output.

html
  // ...
  body
    // ...
    //- html files have no filter and are included verbatim
    include content.html

关于node.js - 有没有办法直接在 Jade 中包含 html 文件或片段?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17903267/

相关文章:

javascript - Express 中不清楚的错误处理

node.js - 错误 : Failed to lookup view in Express

pug - 如何在 Jade 中取消转义 '&'

javascript - 在客户端使用 Jade 语言,应在服务器端编译而不影响条件

javascript - 根据 req.headers 导入动态文件夹 ['accept-language' ]

javascript - res.setHeader ("Set-Cookie", ...) 没有在 Node/Express 中设置 cookie

node.js - Amazon S3 PUT 抛出 "SignatureDoesNotMatch"

Javascript如何在扩展错误中等待 promise

javascript - 运行一些 Ajax 代码在控制台中给出了未定义的值

internationalization - 带有 Express/Jade : Strings with embedded tags and interpolation 的 I18N