Co-authored-by: James Mills <prologic@shortcircuit.net.au> Reviewed-on: https://git.mills.io/prologic/spyda/pulls/2
23 lines
328 B
Go
23 lines
328 B
Go
package templates
|
|
|
|
import (
|
|
"embed"
|
|
"io/fs"
|
|
)
|
|
|
|
//go:embed *.html
|
|
var templates embed.FS
|
|
|
|
// MustGetTemplate returns a template string with the given name.
|
|
func MustGetTemplate(name string) string {
|
|
b, err := templates.ReadFile(name)
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
return string(b)
|
|
}
|
|
|
|
func FS() fs.FS {
|
|
return templates
|
|
}
|