Commit 54f6fbc

Eric Bower  ·  2024-01-16 09:36:40 -0500 EST
parent ad83ff1
fix(static): read from embed fs
1 files changed,  +5, -9
+5, -9
......@@ -24,10 +24,7 @@ import (
2424 "go.uber.org/zap"
2525 )
2626
27-//go:embed static/*
28-var sfs embed.FS
29-
30-//go:embed html/*.tmpl
27+//go:embed html/*.tmpl static/*
3128 var efs embed.FS
3229
3330 type Config struct {
......@@ -332,9 +329,8 @@ func (c *Config) writeHtml(writeData *WriteData) {
332329 bail(err)
333330 }
334331
335-func (c *Config) copyStatic() error {
336- dir := "static"
337- entries, err := sfs.ReadDir(dir)
332+func (c *Config) copyStatic(dir string) error {
333+ entries, err := efs.ReadDir(dir)
338334 bail(err)
339335
340336 for _, e := range entries {
......@@ -343,7 +339,7 @@ func (c *Config) copyStatic() error {
343339 continue
344340 }
345341
346- w, err := os.ReadFile(infp)
342+ w, err := efs.ReadFile(infp)
347343 bail(err)
348344 fp := filepath.Join(c.Outdir, e.Name())
349345 c.Logger.Infof("writing (%s)", fp)
......@@ -1071,7 +1067,7 @@ func main() {
10711067 }
10721068
10731069 config.writeRepo()
1074- config.copyStatic()
1070+ config.copyStatic("static")
10751071
10761072 url := filepath.Join("/", "index.html")
10771073 config.Logger.Info(url)