1
0
mirror of https://github.com/astaxie/beego.git synced 2024-11-26 04:11:30 +00:00

Merge pull request #1765 from saturn4er/fix_layout_rebuild_in_dev

Add layout rebuilding on each request in dev mode
This commit is contained in:
astaxie 2016-03-09 19:02:46 +08:00
commit 686d2e834e

View File

@ -229,7 +229,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
@ -237,6 +239,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)