From 668c151379ea1d9ff77505d74f751ed83a8af029 Mon Sep 17 00:00:00 2001 From: mihna123 Date: Fri, 4 Sep 2026 01:29:39 +0200 Subject: web: serve the stylesheet over a css route Embed the css directory alongside the templates and serve it with a FileServerFS mounted on GET /css/. The directory name matches the url prefix, so the file resolves without an fs.Sub and there is no error path to handle. Adding js later is the same one line. Cover the route in the handler tests, including that template sources stay unreachable and that the href the home page emits resolves to a file that is actually served. --- internal/web/css/style.css | 4 ++++ internal/web/web.go | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) create mode 100644 internal/web/css/style.css (limited to 'internal/web') diff --git a/internal/web/css/style.css b/internal/web/css/style.css new file mode 100644 index 0000000..c2805e2 --- /dev/null +++ b/internal/web/css/style.css @@ -0,0 +1,4 @@ +body { + font-family: sans-serif; + line-height: 1.6; +} diff --git a/internal/web/web.go b/internal/web/web.go index 391aa2a..5db188e 100644 --- a/internal/web/web.go +++ b/internal/web/web.go @@ -2,5 +2,5 @@ package web import "embed" -//go:embed templates +//go:embed templates css var Files embed.FS -- cgit v1.3.1