【问题标题】:Block comments in Pug (Jade)?阻止 Pug (Jade) 中的评论?
【发布时间】:2013-12-27 21:06:16
【问题描述】:

如何在 Pug 模板引擎中阻止注释掉代码?

我知道如何注释掉一行:

//-doesn't show

但我不想像这样写完整的 html cmets:

<!--
    no show
-->

【问题讨论】:

    标签: pug


    【解决方案1】:
    //-
        Just indent the comment
        like normal elements
    

    就像对其他元素一样缩进您的评论。

    请注意缩进正确,否则注释可能超出预期。

    【讨论】:

    • 但是如何评论元素属性呢?
    • 我不完全确定您想要通过评论属性来完成什么。我假设您的意思是在 HTML 标记内添加 cmets?如果是这种情况,那么我知道的 HTML 或 Jade 不支持此功能。
    • 斜线和连字符之间的空格也很重要
    【解决方案2】:

    官方文档

    https://pugjs.org/language/comments.html#block-comments


    缓冲 cmets - 评论将出现在呈现的 HTML 中

    //
        Comments for your HTML readers.
        Use as much text as you want.
    


    无缓冲 cmets - 评论将不会出现在呈现的 HTML 中

    //-
        Comments for your template writers.
        Use as much text as you want.
    

    【讨论】:

      猜你喜欢
      • 2012-01-22
      • 2010-10-06
      • 1970-01-01
      • 2013-10-18
      • 2014-03-29
      • 2010-12-07
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多