评论Jade/pug

Ran*_*lue 75 node.js pug

我尝试在Jade/pug中发表评论,但评论在HTML中呈现为文本.这是我的代码:

doctype html

html(lang='en')
    body
        / This should be a comment
Run Code Online (Sandbox Code Playgroud)

我做什么蠢事?

ale*_*lex 164

评论文档中所述,您可以使用//哪个将转换为HTML注释,或者//-在输出的HTML代码中不可见.

  • @pdelorme no,仅当您还缩进文件的其余部分时. (3认同)
  • 因此,在该行的开头评论评论文件的其余部分...... (2认同)

IRS*_*HAD 5

在 jade 中,我们使用//-进行注释。如果您尝试注释块,请确保它应正确缩进,如下例所示 -

doctype html

html(lang='en')
    body
        //- 
            This should be a comment
            Indent correctly for block content
Run Code Online (Sandbox Code Playgroud)