A block is a “block” of content that you want to insert into the template from which you extend it.
Assuming a catalog layout:
|
|
|
|
Here is an example of using your templates:
//layout.jade
doctype html
html
head
link(href="/favicon.ico", rel="shortcut icon",type="image/x-icon")
link(rel="stylesheet", href="/css/bootstrap.css")
link(rel="stylesheet", href="/vendor/toastr/toastr.css")
link(rel="stylesheet", href="/css/site.css")
body(ng-app="app")
h1 Hello Worldd
block content
include scripts
Then, all other pages that extend from layout.jade can insert content into this block:
//index.jade
extends layout
block main-content
section.content
div(ng-view)
//main.jade
extends layout
block content
h1 This is a Partial
h2 {{ myVar }} // which should be: h2= myVar
This will display (when using Express):
//index.html
doctype html
html
head
link(href="/favicon.ico", rel="shortcut icon",type="image/x-icon")
link(rel="stylesheet", href="/css/bootstrap.css")
link(rel="stylesheet", href="/vendor/toastr/toastr.css")
link(rel="stylesheet", href="/css/site.css")
body(ng-app="app")
h1 Hello Worldd
section.content
div(ng-view)
include scripts
//main.html
doctype html
html
head
link(href="/favicon.ico", rel="shortcut icon",type="image/x-icon")
link(rel="stylesheet", href="/css/bootstrap.css")
link(rel="stylesheet", href="/vendor/toastr/toastr.css")
link(rel="stylesheet", href="/css/site.css")
body(ng-app="app")
h1 Hello Worldd
h1 This is a Partial
h2 {{ myVar }}
include scripts