[英]append head doesn't work in Jade
我的layout.jade
如下:
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
我的place.jade
如下:
extends layout
append head
script(src="/javascripts/custom.js")
...
當我為廟宇服務時,我會看到
這意味着追加根本不呈現。
為什么?
Append僅適用於block,因此layout.jade的正確代碼為
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
對於place.jade將是
extends layout
append scripts
script(src="/javascripts/custom.js")
...
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.