I am trying to use block in include:
for exemple: layout.jade
!!!5
html
head
body
include header
#footer footer
block javascript
script('src'= 'jquery.js')
header.jade
h1 header
append javascript
script
console.log('Hi, I'm header')
I have :
<h1>header</h1>
<script>console.log('Hi, I'm header')</script>
<div id="footer" >footer</div>
<script src="jquery.js" ></script>
And I would have:
<h1>header</h1>
<div id="footer" >footer</div>
<script src="jquery.js" ></script>
<script>console.log('Hi, I'm header')</script>
Thanks :)
blocks don't work that way with included files, as far as I know. Blocks work with the extends
feature. So you could either revise your code to include the javascript as an include
, or revise it to use extend
here's how it might look using extend
layout.jade
!!!
html
head
body
block header
h1 header
block footer
#footer footer
block javascript
script('src'= 'jquery.js')
index.jade
extends layout
append javascript
script
console.log('hi');