gohttpserver/templates/templates.go

20 lines
284 B
Go

package templates
import (
"embed"
"strings"
)
//go:embed *.html
var Templates embed.FS
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()
}