all repos — homestead @ c23b6263c26324f94790f52a447377c3d0696d42

Code for my website

serve style.css from FS in development

Alan Pearce
commit

c23b6263c26324f94790f52a447377c3d0696d42

parent

63d4a89c8633a2a826919128aa0510d02af1986d

1 file changed, 11 insertions(+), 0 deletions(-)

changed files
M internal/website/website.gointernal/website/website.go
@@ -2,6 +2,7 @@ package website
import ( "context" + "net/http" "os" "path/filepath" "slices"
@@ -198,6 +199,16 @@ mux.HandleFunc("/calendar", website.Calendar)
mux.HandleFunc("/.well-known/webfinger", website.webfinger) const oidcPath = "/.well-known/openid-configuration" mux.ServeMux.Handle(oidcPath, ihttp.RedirectHandler(cfg.OIDCHost.JoinPath(oidcPath), 302)) + + if opts.Development { + staticHandler := func(w http.ResponseWriter, r *http.Request) *ihttp.Error { + http.ServeFileFS(w, r, templates.Files, r.URL.Path) + + return nil + } + + mux.HandleFunc("/style.css", staticHandler) + } website.Handler = mux