mirror of
https://github.com/astaxie/beego.git
synced 2024-11-22 17:00:55 +00:00
Add layout rebuilding on each request in dev mode
This commit is contained in:
parent
f6f34306ee
commit
2c5ef8ccc8
@ -230,7 +230,9 @@ func (c *Controller) renderTemplate() (bytes.Buffer, error) {
|
|||||||
}
|
}
|
||||||
if BConfig.RunMode == DEV {
|
if BConfig.RunMode == DEV {
|
||||||
buildFiles := []string{c.TplName}
|
buildFiles := []string{c.TplName}
|
||||||
if c.Layout != "" && c.LayoutSections != nil {
|
if c.Layout != "" {
|
||||||
|
buildFiles = append(buildFiles, c.Layout)
|
||||||
|
if c.LayoutSections != nil {
|
||||||
for _, sectionTpl := range c.LayoutSections {
|
for _, sectionTpl := range c.LayoutSections {
|
||||||
if sectionTpl == "" {
|
if sectionTpl == "" {
|
||||||
continue
|
continue
|
||||||
@ -238,6 +240,7 @@ func (c *Controller) renderTemplate() (bytes.Buffer, error) {
|
|||||||
buildFiles = append(buildFiles, sectionTpl)
|
buildFiles = append(buildFiles, sectionTpl)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
BuildTemplate(BConfig.WebConfig.ViewsPath, buildFiles...)
|
BuildTemplate(BConfig.WebConfig.ViewsPath, buildFiles...)
|
||||||
}
|
}
|
||||||
return buf, executeTemplate(&buf, c.TplName, c.Data)
|
return buf, executeTemplate(&buf, c.TplName, c.Data)
|
||||||
|
Loading…
Reference in New Issue
Block a user