Spaces:
Runtime error
Runtime error
File size: 1,516 Bytes
ed86a97 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 | #!/usr/bin/env bash
# Compila il bundle CSS del design system.
# Uso:
# scripts/build_css.sh # one-shot minified
# scripts/build_css.sh --watch # rebuild continuo (dev)
set -euo pipefail
ROOT_DIR="$(cd "$(dirname "$0")/.." && pwd)"
cd "$ROOT_DIR"
uname_os=$(uname -s | tr '[:upper:]' '[:lower:]')
uname_arch=$(uname -m)
case "$uname_os" in darwin) os="macos" ;; linux) os="linux" ;; *) echo "OS non supportato" >&2; exit 1 ;; esac
case "$uname_arch" in x86_64|amd64) arch="x64" ;; arm64|aarch64) arch="arm64" ;; *) echo "Arch non supportata" >&2; exit 1 ;; esac
BIN="$ROOT_DIR/tools/tailwindcss/$os-$arch/tailwindcss"
if [[ ! -x "$BIN" ]]; then
echo "Tailwind CLI non trovato. Eseguo fetch..."
bash "$ROOT_DIR/scripts/fetch_tailwind.sh"
fi
DESIGN_DIR="$ROOT_DIR/src/web/templates/design"
OUTPUT="$ROOT_DIR/src/web/static/app.css"
CONFIG="$DESIGN_DIR/tailwind.config.js"
# Tailwind CLI standalone non processa @import verso file esterni: concateniamo
# tokens.css + entry.css + legacy-shim.css in un temp file prima di compilare.
TMP_INPUT="$(mktemp -t ai_tester_entry).css"
trap 'rm -f "$TMP_INPUT"' EXIT
{
cat "$DESIGN_DIR/tokens.css"
echo ""
cat "$DESIGN_DIR/entry.css"
echo ""
cat "$DESIGN_DIR/legacy-shim.css"
} > "$TMP_INPUT"
if [[ "${1:-}" == "--watch" ]]; then
exec "$BIN" -c "$CONFIG" -i "$TMP_INPUT" -o "$OUTPUT" --watch
else
"$BIN" -c "$CONFIG" -i "$TMP_INPUT" -o "$OUTPUT" --minify
echo "Bundle generato: $OUTPUT ($(wc -c < "$OUTPUT") bytes)"
fi
|