From b7d3ee578a0fa7c482c386242f2fc52c2600568a Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Tue, 25 Jun 2024 18:13:56 +0200 Subject: fix early panic --- internal/website/mux.go | 1 + templates/page.templ | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/internal/website/mux.go b/internal/website/mux.go index 2d1b971..a6e7ba0 100644 --- a/internal/website/mux.go +++ b/internal/website/mux.go @@ -74,6 +74,7 @@ func NewMux(cfg *config.Config, root string) (mux *http.ServeMux, err error) { if err != nil { return nil, errors.WithMessagef(err, "registering content files") } + templates.Setup() mux.Handle("/", wrapHandler(cfg, func(w http.ResponseWriter, r *http.Request) *HTTPError { urlPath, shouldRedirect := canonicalisePath(r.URL.Path) diff --git a/templates/page.templ b/templates/page.templ index 1667fb0..7869369 100644 --- a/templates/page.templ +++ b/templates/page.templ @@ -11,7 +11,7 @@ var ( css string ) -func init() { +func Setup() { bytes, err := fs.ReadFile(Files, "style.css") if err != nil { panic(err) -- cgit 1.4.1