Template Includes

Inheritance is nice and all, but sometimes we just need a snippet to add at certain parts of the page in various places. Doing this with inheritance is not a good idea. Using the "include" keyword allows us to add on the source of another file.

If we have the following jade files:

// widget.jade
.widget
    p The weather is sunny today


// page.jade
p I wonder what the weather is like today?
include widget

The output of page.jade will logically be equivalent and compile to:

Jade
HTML
<p>I wonder what the weather is like today?</p>
<div class="widget">
  <p>The weather is sunny today</p>
</div>