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?
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.
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.
js, also known as PUG, is a Javascript library that was previously known as JADE. It is an easy-to-code template engine used to code HTML in a more readable fashion. One upside to PUG is that it equips developers to code reusable HTML documents by pulling data dynamically from the API.
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.
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.
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With