test build

This commit is contained in:
Ehab Hassan 2025-05-27 11:56:14 +03:00
parent 4fdc7fefee
commit 694b18ca31
2 changed files with 38 additions and 19 deletions

View File

@ -1,28 +1,29 @@
#!/bin/bash #!/bin/bash
echo "Starting build..." echo "🚀 Starting build..."
SOURCE=${BASH_SOURCE[0]} SOURCE=${BASH_SOURCE[0]}
DIR_OF_THIS_SCRIPT="$( dirname "$SOURCE" )" DIR_OF_THIS_SCRIPT="$( dirname "$SOURCE" )"
ABS_DIR_OF_SCRIPT="$( realpath $DIR_OF_THIS_SCRIPT )" ABS_DIR_OF_SCRIPT="$( realpath "$DIR_OF_THIS_SCRIPT" )"
# Determine platform # Detect platform for Tailwind binary
ASSET="tailwindcss" ASSET="tailwindcss"
if [[ "$OSTYPE" == "linux-gnu"* ]]; then if [[ "$OSTYPE" == "linux-gnu"* ]]; then
ASSET="$ASSET-linux" ASSET="$ASSET-linux"
elif [[ "$OSTYPE" == "darwin"* ]]; then elif [[ "$OSTYPE" == "darwin"* ]]; then
ASSET="$ASSET-macos" ASSET="$ASSET-macos"
fi fi
if [[ "$(uname -m)" == "x86_64"* ]]; then if [[ "$(uname -m)" == "x86_64"* ]]; then
ASSET="$ASSET-x64" ASSET="$ASSET-x64"
elif [[ "$(uname -m)" == "arm64"* ]]; then elif [[ "$(uname -m)" == "arm64"* ]]; then
ASSET="$ASSET-arm64" ASSET="$ASSET-arm64"
fi fi
# Get the latest version from GitHub # Get latest Tailwind version from GitHub
LATEST_VERSION=$(curl -s https://api.github.com/repos/tailwindlabs/tailwindcss/releases/latest | grep '"tag_name":' | cut -d '"' -f 4) LATEST_VERSION=$(curl -s https://api.github.com/repos/tailwindlabs/tailwindcss/releases/latest | grep '"tag_name":' | cut -d '"' -f 4)
# Get current version (if exists) # Check current version
CURRENT_VERSION="" CURRENT_VERSION=""
if [[ -f "./tailwindcss" ]]; then if [[ -f "./tailwindcss" ]]; then
CURRENT_VERSION=$(./tailwindcss -v | awk '{print $2}') CURRENT_VERSION=$(./tailwindcss -v | awk '{print $2}')
@ -31,26 +32,37 @@ fi
echo "Current Tailwind version: $CURRENT_VERSION" echo "Current Tailwind version: $CURRENT_VERSION"
echo "Latest Tailwind version: $LATEST_VERSION" echo "Latest Tailwind version: $LATEST_VERSION"
# Download only if outdated or not installed # Download Tailwind binary if needed
if [[ "$CURRENT_VERSION" != "$LATEST_VERSION" ]]; then if [[ "$CURRENT_VERSION" != "$LATEST_VERSION" ]]; then
echo "Updating Tailwind to latest version..." echo "⬇️ Downloading latest Tailwind..."
rm -f tailwindcss rm -f tailwindcss
curl -sLO "https://github.com/tailwindlabs/tailwindcss/releases/download/${LATEST_VERSION}/${ASSET}" curl -sLO "https://github.com/tailwindlabs/tailwindcss/releases/download/${LATEST_VERSION}/${ASSET}"
chmod +x $ASSET chmod +x $ASSET
mv $ASSET tailwindcss mv $ASSET tailwindcss
else else
echo "Tailwind is already up to date." echo "Tailwind is up to date."
fi fi
# Initialize tailwind.config.js if not exists # Initialize Tailwind config if needed
if [[ ! -f "tailwind.config.js" ]]; then if [[ ! -f "tailwind.config.js" ]]; then
echo "Initializing tailwind.config.js..." echo "🛠 Initializing Tailwind config..."
./tailwindcss init ./tailwindcss init
sed -i '' "s| content: \[\],| content: \['./templates/**/*.html'\],|g" tailwind.config.js sed -i.bak "s| content: \[\],| content: \['./templates/**/*.html'\],|g" tailwind.config.js
fi fi
# Build Tailwind CSS and Zola # Ensure static/css exists
echo "Compiling Tailwind CSS and building Zola site..." mkdir -p static/css
rm -rf public static/css
# Clean previous build
rm -rf public
# Compile Tailwind
echo "🧵 Building Tailwind CSS..."
./tailwindcss -i css/index.css -o static/css/index.css --minify ./tailwindcss -i css/index.css -o static/css/index.css --minify
# Build Zola site
echo "🏗 Running Zola..."
zola --root "$ABS_DIR_OF_SCRIPT" build zola --root "$ABS_DIR_OF_SCRIPT" build
echo "✅ Build complete. Check public/ folder."

View File

@ -1,14 +1,21 @@
/*! purgecss start ignore */
/* @import "nav.css"; */
/*! purgecss end ignore */
@tailwind base; @tailwind base;
@tailwind components; @tailwind components;
@tailwind utilities; @tailwind utilities;
@tailwind typography;
@layer components {
/* .btn-primary {
@apply py-1.5 px-3 text-center bg-blue-700 rounded-md text-white;
} */
}
@import "tailwindcss/base";
@import "layout.css";
@import "tailwindcss/components";
@import "admonition.css";
@import "tailwindcss/utilities";
@import url('https://fonts.googleapis.com/css2?family=Lato:ital,wght@0,100;0,300;0,400;0,700;0,900;1,100;1,300;1,400;1,700;1,900&display=swap'); @import url('https://fonts.googleapis.com/css2?family=Lato:ital,wght@0,100;0,300;0,400;0,700;0,900;1,100;1,300;1,400;1,700;1,900&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Inter:ital,opsz,wght@0,14..32,100..900;1,14..32,100..900&family=Raleway:ital,wght@0,100..900;1,100..900&display=swap'); @import url('https://fonts.googleapis.com/css2?family=Inter:ital,opsz,wght@0,14..32,100..900;1,14..32,100..900&family=Raleway:ital,wght@0,100..900;1,100..900&display=swap');