有没有办法为Meteor加载的自动加载的css或js文件指定顺序.
搜索了文档但找不到任何内容.
我问,因为我正在玩舞台,我正在尝试使用Twitter Bootstrap和Meteor.在Bootstrap附带的示例中,始终在bootstrap-responsive.css之前加载基本bootstrap.css.
有任何想法吗?
给定一组模板,例如:
<html>
<head>
<title>Some title</title>
{{template extracss}}
</head>
<body>
<h1>Page title</h1>
{{template content .}}
</body>
</html>
Run Code Online (Sandbox Code Playgroud)
{{define "content"}}
<p>page content goes here</p>
{{end}}
Run Code Online (Sandbox Code Playgroud)
{{define "content"}}
<form>form content goes here</form>
{{end}}
{{define "extracss"}}<style>body{background:pink}</style>{{end}}
Run Code Online (Sandbox Code Playgroud)
使用它来渲染模板:
func Render(w http.ResponseWriter, tmpname string, data interface{}) {
t, err := template.ParseFiles("views/layout.tpl", "views/"+tmpname+".tpl")
// parse error
if err != nil {
http.Error(w, err.Error(), http.StatusInternalServerError)
}
if err := t.Execute(w, data); err != nil {
http.Error(w, err.Error(), http.StatusInternalServerError)
}
}
Run Code Online (Sandbox Code Playgroud)
edit.tpl 将正确呈现,因为它定义了“extracss”,而 home.tpl 将不会正确呈现,因为模板解析器正确地说“没有这样的模板“extracss””。
那么我将使用什么机制来允许使用“可选”模板? …