#!/usr/bin/env bash
# Build the purged Tailwind stylesheet (ngsite/static/css/tailwind.css) that
# replaces the Play CDN. Needs the Tailwind standalone CLI (no Node):
# default ~/bin/tailwindcss, override with TAILWIND_CLI. Run before deploy
# (deploy.sh calls this) and once locally so the dev server has styles.
set -euo pipefail
ROOT="$(cd "$(dirname "$0")/.." && pwd)"   # the web/ dir
TW="${TAILWIND_CLI:-$HOME/bin/tailwindcss}"
[ -x "$TW" ] || { echo "ERROR: tailwindcss CLI not at $TW (set TAILWIND_CLI)" >&2; exit 1; }
cd "$ROOT"
"$TW" -c tailwind.config.js -i tailwind.input.css \
      -o ngsite/static/css/tailwind.css --minify
echo "  built ngsite/static/css/tailwind.css ($(wc -c < ngsite/static/css/tailwind.css) bytes)"
