代码拉取完成,页面将自动刷新
Middleware renders is a go template render middlewaer for Tango.
v0.2.0510 Added RenderBytes for Renderer and simplifed codes.
go get github.com/tango-contrib/renders
type RenderAction struct {
renders.Renderer
}
func (x *RenderAction) Get() {
x.Render("test.html", renders.T{
"test": "test",
})
}
func main() {
t := tango.Classic()
t.Use(renders.New(renders.Options{
Reload: true, // if reload when template is changed
Directory: "./templates", // Directory to load templates
Funcs: template.FuncMap{
"test": func() string {
return "test"
},
},
// Vars is a data map for global
Vars: renders.T{
"var": var,
}
Charset: "UTF-8", // Appends the given charset to the Content-Type header. Default is UTF-8
// Allows changing of output to XHTML instead of HTML. Default is "text/html"
HTMLContentType: "text/html",
DelimsLeft:"{{",
DelimsRight:"}}", // default Delims is {{}}, if it conflicts with your javascript template such as angluar, you can change it.
}))
}
This project is under BSD License. See the LICENSE file for the full license text.
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。