80

I tried making comments in Jade/pug, but the comments render as text in the HTML. This is my code:

doctype html

html(lang='en')
    body
        / This should be a comment

What am I doing something stupid?

bugwheels94
  • 30,681
  • 3
  • 39
  • 60
Randomblue
  • 112,777
  • 145
  • 353
  • 547

2 Answers2

171

As written in the comment documentation, you can either use // which will translate to a HTML comment or //- which won't be visible in the outputted HTML code.

Emile Bergeron
  • 17,074
  • 5
  • 83
  • 129
alessioalex
  • 62,577
  • 16
  • 155
  • 122
5

In jade we use //- for comment. If you are trying to comment a block, make sure it should be indented properly like in below example-

doctype html

html(lang='en')
    body
        //- 
            This should be a comment
            Indent correctly for block content
IRSHAD
  • 2,855
  • 30
  • 39
  • 1
    While this code snippet may solve the question, [including an explanation](//meta.stackexchange.com/questions/114762/explaining-entirely-code-based-answers) really helps to improve the quality of your post. Remember that you are answering the question for readers in the future, and those people might not know the reasons for your code suggestion. Please also try not to crowd your code with explanatory comments, this reduces the readability of both the code and the explanations! – kayess Dec 06 '16 at 09:52