Block comments in Pug (Jade)?
Asked Answered
P

2

34

How do you block comment out code in the Pug templating engine?

I know how to comment out a line:

//-doesn't show

but I don't want to have to write in full html comments like so:

<!--
    no show
-->
Prior answered 10/12, 2013 at 11:14 Comment(0)
C
63
//-
    Just indent the comment
    like normal elements

Just indent your comment like you do other elements.

Just be careful that you have your indention correct or you may comment out more than you intended.

Cholesterol answered 10/12, 2013 at 18:11 Comment(3)
But how to comment element attribute?Infielder
I'm not entirely sure what you are wanting to accomplish by commenting attributes. I assume you mean adding comments inside of an HTML tag? If that is the case then this is not supported in HTML or Jade that I'm aware of.Cholesterol
And the space between the slashes and hyphens also matterAnder
B
8

Official Documentation

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


Buffered comments - The comment will appear in rendered HTML

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


Unbuffered comments - The comment will not appear in rendered HTML

//-
    Comments for your template writers.
    Use as much text as you want.
Bywoods answered 19/8, 2020 at 10:4 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.