summaryrefslogtreecommitdiff
path: root/internal/web
diff options
context:
space:
mode:
authormihna123 <mihailonvojinovic@gmail.com>2026-09-04 01:29:39 +0200
committermihna123 <mihailonvojinovic@gmail.com>2026-09-04 01:29:39 +0200
commit668c151379ea1d9ff77505d74f751ed83a8af029 (patch)
treec19ed88cef013e34aea1ada97baff516cfbe2f73 /internal/web
parent2e227424ba3a5bcc703936c35bcadba8cda0931f (diff)
downloadopenstore-668c151379ea1d9ff77505d74f751ed83a8af029.tar.gz
openstore-668c151379ea1d9ff77505d74f751ed83a8af029.zip
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.
Diffstat (limited to 'internal/web')
-rw-r--r--internal/web/css/style.css4
-rw-r--r--internal/web/web.go2
2 files changed, 5 insertions, 1 deletions
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