Removed old template pre-compilation. Added go:generate command to create an index.jade.go file.
This commit is contained in:
parent
595d7769ec
commit
5be38c00cf
22
web/web.go
22
web/web.go
@ -1,15 +1,13 @@
|
||||
package web
|
||||
|
||||
import (
|
||||
"dwelling-radio/pkg/logging"
|
||||
"embed"
|
||||
"html/template"
|
||||
"io/fs"
|
||||
"net/http"
|
||||
|
||||
"github.com/Joker/jade"
|
||||
)
|
||||
|
||||
//go:generate /home/arav/go/bin/jade -pkg=web -writer templates/index.jade
|
||||
|
||||
//go:embed assets
|
||||
var assetsDir embed.FS
|
||||
|
||||
@ -21,19 +19,3 @@ func Assets() http.FileSystem {
|
||||
func AssetsGetFile(path string) ([]byte, error) {
|
||||
return assetsDir.ReadFile("assets/" + path)
|
||||
}
|
||||
|
||||
//go:embed templates/index.jade
|
||||
var indexJadeTpl []byte
|
||||
var IndexTemplate *template.Template
|
||||
|
||||
func CompileTemplates(lErr *logging.Logger) {
|
||||
indexParsedTpl, err := jade.Parse("index", indexJadeTpl)
|
||||
if err != nil {
|
||||
lErr.Fatalln(err)
|
||||
}
|
||||
|
||||
IndexTemplate, err = template.New("index").Parse(indexParsedTpl)
|
||||
if err != nil {
|
||||
lErr.Fatalln(err)
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user