问题
My layout.jade
is following:
doctype html
html
head
title= title
link(rel='stylesheet', href='/stylesheets/style.css')
link(rel='stylesheet', href='/stylesheets/bootstrap.css')
link(rel='stylesheet', href='/stylesheets/bootstrap-grid.css')
link(rel='stylesheet', href='/stylesheets/bootstrap-reboot.css')
script(src="/javascripts/core.js")
script(src="/javascripts/jquery.js")
script(src="/javascripts/jquery-slim.js")
script(src="/javascripts/bootstrap.js")
body
block content
My place.jade
is following:
extends layout
append head
script(src="/javascripts/custom.js")
...
When I serve templete, I see
Which meand appending doesn't render at all.
Why?
回答1:
Append works only with block so the correct code of layout.jade is
doctype html
html
head
block scripts
title= title
link(rel='stylesheet', href='/stylesheets/style.css')
link(rel='stylesheet', href='/stylesheets/bootstrap.css')
link(rel='stylesheet', href='/stylesheets/bootstrap-grid.css')
link(rel='stylesheet', href='/stylesheets/bootstrap-reboot.css')
script(src="/javascripts/core.js")
script(src="/javascripts/jquery.js")
script(src="/javascripts/jquery-slim.js")
script(src="/javascripts/bootstrap.js")
body
block content
and for place.jade will be
extends layout
append scripts
script(src="/javascripts/custom.js")
...
来源:https://stackoverflow.com/questions/44586130/append-head-doesnt-work-in-jade