From 5be38c00cf50239c11c2939821496ab2af58fa2e Mon Sep 17 00:00:00 2001 From: "Alexander \"Arav\" Andreev" Date: Mon, 13 Jun 2022 18:39:30 +0400 Subject: [PATCH] Removed old template pre-compilation. Added go:generate command to create an index.jade.go file. --- web/web.go | 22 ++-------------------- 1 file changed, 2 insertions(+), 20 deletions(-) diff --git a/web/web.go b/web/web.go index afb3d81..dd10c37 100644 --- a/web/web.go +++ b/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) - } -}