1
0
mirror of https://github.com/kataras/iris.git synced 2026-01-24 20:35:59 +00:00

minor fixes on jet and pug view engines

This commit is contained in:
Gerasimos (Makis) Maropoulos
2022-09-27 22:42:42 +03:00
parent 29010bfd7c
commit 50d346de84
6 changed files with 37 additions and 16 deletions

View File

@@ -34,6 +34,8 @@ type HTMLEngine struct {
//
middleware func(name string, contents []byte) (string, error)
onLoad func()
onLoaded func()
Templates *template.Template
customCache []customTmp // required to load them again if reload is true.
bufPool *sync.Pool
@@ -250,6 +252,10 @@ func (s *HTMLEngine) Load() error {
}
func (s *HTMLEngine) load() error {
if s.onLoad != nil {
s.onLoad()
}
if err := s.reloadCustomTemplates(); err != nil {
return err
}
@@ -284,6 +290,10 @@ func (s *HTMLEngine) load() error {
return s.parseTemplate(path, buf, nil)
})
if s.onLoaded != nil {
s.onLoaded()
}
if err != nil {
return err
}