gohttpserver/templates/templates.go
Jeffrey Paul dd778174a7
Some checks failed
continuous-integration/drone/push Build is failing
sneak/integrate-di (#17)
moving this to use uber/fx di framework instead of the ad hoc di setup before

Co-authored-by: sneak <sneak@sneak.berlin>
Reviewed-on: #17
2023-01-29 03:06:05 +00:00

30 lines
506 B
Go

package templates
import (
"embed"
"text/template"
)
//go:embed *.html
var TemplatesRaw embed.FS
var TemplatesParsed *template.Template
func GetParsed() *template.Template {
if TemplatesParsed == nil {
TemplatesParsed = template.Must(template.ParseFS(TemplatesRaw, "*"))
}
return TemplatesParsed
}
/*
func MustString(filename string) string {
bytes, error := Templates.ReadFile(filename)
if error != nil {
panic(error)
}
var out strings.Builder
out.Write(bytes)
return out.String()
}
*/