Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Block comments in Pug (Jade)?

Tags:

pug

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 --> 
like image 624
sidonaldson Avatar asked Dec 10 '13 11:12

sidonaldson


People also ask

How do you comment out on a pug?

Simply add a hyphen ( - ) to the start of the comment. These are only for commenting on the Pug code itself, and do not appear in the rendered HTML.

How do you comment on Jade?

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.

How do you use Pug variables?

The names of the variables in your Pug file become siteColors and siteNames . To set the entirety of an HTML element equal to a variable, use the equals operator = to do so. If your variable needs to be embedded inline, use bracket syntax #{} to do so.


1 Answers

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

like image 156
Dan Armstrong Avatar answered Oct 05 '22 20:10

Dan Armstrong