diff options
author | Alan Pearce | 2024-05-31 03:10:46 +0200 |
---|---|---|
committer | Alan Pearce | 2024-05-31 03:10:46 +0200 |
commit | fc7542e01f1d6f9e1c11bacf0060c0165ba54986 (patch) | |
tree | b1aabe8e45e2200d03ed7a2a86c4dccc1fb25cbd /internal/server | |
parent | b53769462bf830f860b7d741a3d0801afdbc9aa2 (diff) | |
download | searchix-fc7542e01f1d6f9e1c11bacf0060c0165ba54986.tar.lz searchix-fc7542e01f1d6f9e1c11bacf0060c0165ba54986.tar.zst searchix-fc7542e01f1d6f9e1c11bacf0060c0165ba54986.zip |
build: re-enable asset reloading in dev
Diffstat (limited to 'internal/server')
-rw-r--r-- | internal/server/mux.go | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/internal/server/mux.go b/internal/server/mux.go index 87e878a..2837dc0 100644 --- a/internal/server/mux.go +++ b/internal/server/mux.go @@ -43,7 +43,7 @@ type TemplateData struct { ExtraHeadHTML template.HTML Code int Message string - Assets frontend.AssetCollection + Assets *frontend.AssetCollection } type ResultData struct { @@ -282,6 +282,12 @@ func NewMux( } go fw.Start(func(filename string) { slog.Debug(fmt.Sprintf("got filename %s", filename)) + if match, _ := path.Match("frontend/static/*", filename); match { + err := frontend.Rehash() + if err != nil { + slog.Error("failed to re-hash frontend assets", "error", err) + } + } if path.Ext(filename) == ".gotmpl" { templates, err = loadTemplates() if err != nil { |