0
0
mirror of https://github.com/thegeeklab/wp-plugin-go.git synced 2024-11-28 08:30:37 +00:00
wp-plugin-go/template/functions.go

23 lines
333 B
Go
Raw Normal View History

2023-02-08 12:42:55 +00:00
package template
import (
"text/template"
"github.com/Masterminds/sprig/v3"
)
func LoadFuncMap() template.FuncMap {
2023-02-08 12:42:55 +00:00
sprigFuncs := sprig.GenericFuncMap()
customFuncs := template.FuncMap{}
for name, f := range customFuncs {
if _, ok := sprigFuncs[name]; ok {
continue
}
sprigFuncs[name] = f
}
return sprigFuncs
}