31 lines
389 B
Go
31 lines
389 B
Go
|
package frontend
|
||
|
|
||
|
import (
|
||
|
"embed"
|
||
|
"html/template"
|
||
|
"io/fs"
|
||
|
)
|
||
|
|
||
|
var (
|
||
|
//go:embed static
|
||
|
static embed.FS
|
||
|
Static fs.FS
|
||
|
|
||
|
//go:embed *.html
|
||
|
templatesFS embed.FS
|
||
|
Templates *template.Template
|
||
|
)
|
||
|
|
||
|
func init() {
|
||
|
var err error
|
||
|
Templates, err = template.ParseFS(templatesFS, "*")
|
||
|
if err != nil {
|
||
|
panic(err)
|
||
|
}
|
||
|
|
||
|
Static, err = fs.Sub(static, "static")
|
||
|
if err != nil {
|
||
|
panic(err)
|
||
|
}
|
||
|
}
|