enable changes to styles in dev mode
Alan Pearce alan@alanpearce.eu
Thu, 13 Jun 2024 17:31:24 +0200
2 files changed, 3 insertions(+), 0 deletions(-)
M internal/builder/builder.go → internal/builder/builder.go
@@ -7,6 +7,7 @@ "net/url" "os" "path" "slices" + "sync" "time" "website/internal/config" @@ -62,6 +63,7 @@ } func build(outDir string, config config.Config) error { log.Debug("output", "dir", outDir) + assetsOnce = sync.Once{} privateDir := path.Join(outDir, "private") if err := mkdirp(privateDir); err != nil { return errors.WithMessage(err, "could not create private directory")
M internal/server/server.go → internal/server/server.go
@@ -39,6 +39,7 @@ *http.Server } func applyDevModeOverrides(config *cfg.Config, listenAddress string) { + config.CSP.StyleSrc = slices.Insert(config.CSP.StyleSrc, 0, "'unsafe-inline'") config.CSP.ScriptSrc = slices.Insert(config.CSP.ScriptSrc, 0, "'unsafe-inline'") config.CSP.ConnectSrc = slices.Insert(config.CSP.ConnectSrc, 0, "'self'") config.BaseURL = cfg.URL{