【问题标题】:Implement HTML like template in PUG在 PUG 中实现类似 HTML 的模板
【发布时间】:2021-06-15 17:48:53
【问题描述】:

我正在尝试在 pug 中实现类似 html 的模板

#{name}

但这不起作用,它会重复打印然后我使用管道字符

|#{name}

但它的输出是<h1>This Is Content<h1&gt 我的完整模板是

<html lang="en">
<head>
  SomeRandomStuff
</head>
<body>
  |#{Content}
</body>
Scripts
</html>

【问题讨论】:

  • 好像是文字编码的问题,能不能分享一下文字应该是什么的图片?
  • 尝试将此html head meta(charset="utf-8") 添加到文件顶部

标签: express pug ejs


【解决方案1】:

请改用!{name}

<html lang="en">
<head>
  SomeRandomStuff
</head>
<body>
  !{Content}
</body>
Scripts
</html>

See docs here.

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2013-02-23
    • 1970-01-01
    • 2023-03-13
    • 1970-01-01
    • 2020-02-14
    • 2023-03-29
    • 2011-06-26
    • 1970-01-01
    相关资源
    最近更新 更多