ref(frontend): Replace Bootstrap with Tailwind CSS
Swap the Bootstrap CDN for a self-hosted Tailwind CSS build, mirroring the myice setup: standalone Tailwind CLI v3.4.17, a one-off build-css.sh script, and a gitignored generated style.css. - Add tailwind.config.js, style-input.css, build-css.sh at repo root - Rewrite templates/index.html: drop Bootstrap link/script, link /style.css, convert all classes to Tailwind utilities; showAlert now uses a class lookup so the JIT scanner detects dynamic classes - Add /style.css FileResponse route in main.py; drop cdn.jsdelivr.net from script-src/style-src in the CSP - Flip test assertion to assert cdn.jsdelivr.net is absent from CSP The generated style.css and tailwindcss binary are gitignored; run ./build-css.sh to regenerate (or --watch for dev).
This commit is contained in:
Executable
+41
@@ -0,0 +1,41 @@
|
||||
#!/bin/bash
|
||||
set -euo pipefail
|
||||
|
||||
# Build CSS using Tailwind CSS standalone CLI
|
||||
# For local development, run:
|
||||
# ./build-css.sh # one-off build
|
||||
# ./build-css.sh --watch # watch mode
|
||||
|
||||
version="v3.4.17"
|
||||
os="$(uname -s)"
|
||||
arch="$(uname -m)"
|
||||
|
||||
case "$os" in
|
||||
Linux*) platform="linux";;
|
||||
Darwin*) platform="macos";;
|
||||
*) echo "Unsupported OS: $os"; exit 1;;
|
||||
esac
|
||||
|
||||
case "$arch" in
|
||||
x86_64) arch="x64";;
|
||||
arm64) arch="arm64";;
|
||||
aarch64) arch="arm64";;
|
||||
*) echo "Unsupported architecture: $arch"; exit 1;;
|
||||
esac
|
||||
|
||||
binary="tailwindcss-${platform}-${arch}"
|
||||
url="https://github.com/tailwindlabs/tailwindcss/releases/download/${version}/${binary}"
|
||||
|
||||
if [ ! -f "tailwindcss" ]; then
|
||||
echo "Downloading Tailwind CSS standalone CLI (${version} ${platform}/${arch})..."
|
||||
curl -sL "$url" -o tailwindcss
|
||||
chmod +x tailwindcss
|
||||
fi
|
||||
|
||||
if [ "${1:-}" == "--watch" ]; then
|
||||
echo "Building CSS in watch mode..."
|
||||
./tailwindcss -i ./style-input.css -o ./style.css --watch
|
||||
else
|
||||
echo "Building CSS..."
|
||||
./tailwindcss -i ./style-input.css -o ./style.css --minify
|
||||
fi
|
||||
Reference in New Issue
Block a user