1
0
mirror of https://github.com/astaxie/beego.git synced 2024-11-22 18:30:56 +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,12 +229,15 @@ 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 != "" {
for _, sectionTpl := range c.LayoutSections { buildFiles = append(buildFiles, c.Layout)
if sectionTpl == "" { if c.LayoutSections != nil {
continue for _, sectionTpl := range c.LayoutSections {
if sectionTpl == "" {
continue
}
buildFiles = append(buildFiles, sectionTpl)
} }
buildFiles = append(buildFiles, sectionTpl)
} }
} }
BuildTemplate(BConfig.WebConfig.ViewsPath, buildFiles...) BuildTemplate(BConfig.WebConfig.ViewsPath, buildFiles...)