This repository has been archived on 2022-05-25. You can view files and clone it, but cannot push or open issues or pull requests.
elon-eats-my-tweets/templates/templates.go

21 lines
345 B
Go

package templates
import (
"embed"
"html/template"
"io"
)
//go:embed views/*.html
var tmplFS embed.FS
var templatesMap *template.Template
func init() {
templatesMap = template.Must(template.ParseFS(tmplFS, "views/*.html"))
}
func Execute(w io.Writer, name string, data any) error {
return templatesMap.ExecuteTemplate(w, name, data)
}