Book Image

Web Development with Jade

By : Sean Lang
Book Image

Web Development with Jade

By: Sean Lang

Overview of this book

Table of Contents (16 chapters)

Comments


Single line

Normal HTML comments are pretty verbose, so Jade offers us a much shorter way to write them that looks similar to JavaScript comments.

Jade

HTML

//a single line comment
<!-- a single line comment-->

Also, if you don't want your comments to show up in the compiled HTML, you can use silent comments by adding a - (hyphen) after //.

//- a silent single line comment

Block comments

But of course, we need to be able to comment out multiple lines too; for that, we use block comments. If you indent a block after a comment, that block will be added to the comment too. An example of this is as follows:

Jade

HTML

// a block comment
  h1 Now I'm Commented Out.
  p And me too.
<!-- a block comment
h1 Now I'm Commented Out.
p And me too.-->

As you can see, the first line of the comment becomes a text block, and the indented block is not parsed. However, the first line is entirely optional and is generally just used to note what was commented out. We can omit it if we want to...