This commit is contained in:
xing 2022-09-19 12:45:41 +08:00
parent cf79d4d9e0
commit dd4560d4f8
2 changed files with 2 additions and 2 deletions

View File

@ -24,7 +24,7 @@ func SetupRouter() *gin.Engine {
"dateCh": func(t time.Time) interface{} {
return t.Format("2006年 01月 02日")
},
}).AddTemplate()
}).SetTemplate()
r.Use(middleware.SetStaticFileCache)
//gzip 因为一般会用nginx做反代时自动使用gzip,所以go这边本身可以不用
/*r.Use(gzip.Gzip(gzip.DefaultCompression, gzip.WithExcludedPaths([]string{

View File

@ -20,7 +20,7 @@ func NewFsTemplate(funcMap template.FuncMap) *FsTemplate {
return &FsTemplate{FuncMap: funcMap, Templates: make(map[string]*template.Template)}
}
func (t *FsTemplate) AddTemplate() *FsTemplate {
func (t *FsTemplate) SetTemplate() *FsTemplate {
mainTemplates, err := fs.Glob(TemplateFs, "*[^layout]/*.gohtml")
if err != nil {
panic(err)