1
0
mirror of https://github.com/astaxie/beego.git synced 2024-06-23 19:44:13 +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 {
buildFiles := []string{c.TplName}
if c.Layout != "" && c.LayoutSections != nil {
for _, sectionTpl := range c.LayoutSections {
if sectionTpl == "" {
continue
if c.Layout != "" {
buildFiles = append(buildFiles, c.Layout)
if c.LayoutSections != nil {
for _, sectionTpl := range c.LayoutSections {
if sectionTpl == "" {
continue
}
buildFiles = append(buildFiles, sectionTpl)
}
buildFiles = append(buildFiles, sectionTpl)
}
}
BuildTemplate(BConfig.WebConfig.ViewsPath, buildFiles...)