1
0
mirror of https://github.com/kataras/iris.git synced 2026-01-09 04:51:56 +00:00

view: allow only-custom template parsing

This commit is contained in:
Gerasimos (Makis) Maropoulos
2023-03-13 14:39:11 +02:00
parent c9c13d76b5
commit 7672574232
4 changed files with 28 additions and 1 deletions

View File

@@ -13,6 +13,8 @@ import (
"sync"
"sync/atomic"
"github.com/kataras/iris/v12/context"
"github.com/eknkc/amber"
)
@@ -152,6 +154,11 @@ func (s *AmberEngine) AddFunc(funcName string, funcBody interface{}) {
//
// Returns an error if something bad happens, user is responsible to catch it.
func (s *AmberEngine) Load() error {
// If only custom templates should be loaded.
if (s.fs == nil || context.IsNoOpFS(s.fs)) && len(s.templateCache) > 0 {
return nil
}
rootDirName := getRootDirName(s.fs)
return walk(s.fs, "", func(path string, info os.FileInfo, err error) error {