diff --git a/web/app/templates/base.html b/web/app/templates/base.html index b7a0313..37a5e9b 100644 --- a/web/app/templates/base.html +++ b/web/app/templates/base.html @@ -14,16 +14,16 @@ - +
-
+
@@ -42,7 +42,7 @@ @@ -57,10 +57,15 @@ - +
+ class="{% block main_class %}flex-1 w-full px-4 py-8 mx-auto max-w-7xl sm:px-8{% endblock %}"> {% block content %}{% endblock %}
+ {% if debug %} + + + {% endif %} diff --git a/web/dev.sh b/web/dev.sh index e6122b6..bdf757a 100755 --- a/web/dev.sh +++ b/web/dev.sh @@ -5,6 +5,7 @@ cd "$(dirname "$0")" export DATABASE_URL="postgresql+asyncpg://firebreak:firebreak@localhost:5432/firebreak_db" export FIREBREAK_PUBLIC_BASE_URL="http://localhost:8000" +export DEBUG="true" # enables the dev-only CSS live reload echo "Starting local Postgres and Adminer..." docker compose -f ../docker-compose.yml up -d db adminer @@ -16,11 +17,25 @@ echo "Starting Firebreak dev server..." echo " FastAPI: http://localhost:8000" echo " Adminer: http://localhost:8080" echo " PostgreSQL / db / firebreak / firebreak / firebreak_db" -echo " CSS: watching app/static/css/input.css" +echo " CSS: watching app/templates and app/static/css/input.css" -./tailwindcss -i ./app/static/css/input.css -o ./app/static/css/output.css --watch & +# Rebuild Tailwind whenever templates or the input CSS change. `entr -d` exits +# when a new file appears in a watched directory, so the loop re-scans and picks +# up newly added templates without needing a manual restart. +if command -v entr >/dev/null 2>&1; then + ( + while true; do + find app/templates app/static/css/input.css \ + | entr -d ./tailwindcss -i ./app/static/css/input.css -o ./app/static/css/output.css + done + ) & +else + echo " (entr not installed — falling back to 'tailwindcss --watch';" + echo " new template files will need a dev.sh restart. Install: brew install entr)" + ./tailwindcss -i ./app/static/css/input.css -o ./app/static/css/output.css --watch & +fi TW_PID=$! -trap "kill $TW_PID 2>/dev/null" EXIT +trap 'kill "$TW_PID" 2>/dev/null; pkill -P "$TW_PID" 2>/dev/null' EXIT uv run uvicorn app.main:app --reload --port 8000