sidonaldson
sidonaldson

Reputation: 25304

Block comments in Pug (Jade)?

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
-->

Upvotes: 35

Views: 24288

Answers (2)

Jawad Ahbab
Jawad Ahbab

Reputation: 1637

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.

Upvotes: 8

Dan Armstrong
Dan Armstrong

Reputation: 2106

//-
    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.

Upvotes: 65

Related Questions