all repos — website @ a00efb33a128ea0b422de01a56c585c93f8d3d13

My website

enable changes to styles in dev mode
Alan Pearce alan@alanpearce.eu
Thu, 13 Jun 2024 17:31:24 +0200
commit

a00efb33a128ea0b422de01a56c585c93f8d3d13

parent

f9b4d8ec8c475c541960e89022c28f950e8f0a2a

2 files changed, 3 insertions(+), 0 deletions(-)

jump to
M internal/builder/builder.gointernal/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.gointernal/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{