Add live reload support for local development

Replace static HTTP server with livereload-based dev server that watches
posts/, layout/, and static/ directories for changes, rebuilds the site,
and auto-refreshes the browser.
This commit is contained in:
Yax 2026-01-18 17:41:33 +01:00
parent 433d3b4a2a
commit 633c6e0b91
3 changed files with 30 additions and 4 deletions

View file

@ -3,14 +3,14 @@
# declare phony targets
.PHONY: build test typecheck
# run locally (uses --local-stacosys if stacosys is running on port 8100)
# run locally with live reload (uses --local-stacosys if stacosys is running on port 8100)
# watches posts/ for changes, regenerates site, and auto-refreshes browser
site:
@if curl -s --connect-timeout 1 http://127.0.0.1:8100/api > /dev/null 2>&1; then \
uv run python makesite.py --local-stacosys; \
uv run python devserver.py --local-stacosys; \
else \
uv run python makesite.py --local; \
uv run python devserver.py --local; \
fi
cd _site && python -m SimpleHTTPServer 2> /dev/null || python3 -m http.server
# run type checks
typecheck: