Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to pass variables between jade templates

I am using a template as a base, and want it to be aware of some variables set in the page that is using it...

File: template.jade

vars = vars || {some:"variables"} !!! 5 head     title vars.some 

File: page.jade

vars = {some:"things"} //- this does not get used from within template.jade extends template 

I want the compiled page.jade to have a title "things"

like image 764
Billy Moon Avatar asked Sep 28 '12 19:09

Billy Moon


1 Answers

I find solution here

pass block with variables

template.jade:

!!! html   block vars   head       title #{pageTitle} - default www title   body 

page.jade

extends template block vars   - var pageTitle = 'Home' 
like image 62
Roman Rhrn Nesterov Avatar answered Sep 25 '22 17:09

Roman Rhrn Nesterov