diff --git a/build.sh b/build.sh index 68441f3..059f690 100755 --- a/build.sh +++ b/build.sh @@ -1,28 +1,29 @@ #!/bin/bash -echo "Starting build..." +echo "๐Ÿš€ Starting build..." SOURCE=${BASH_SOURCE[0]} 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" if [[ "$OSTYPE" == "linux-gnu"* ]]; then ASSET="$ASSET-linux" elif [[ "$OSTYPE" == "darwin"* ]]; then ASSET="$ASSET-macos" fi + if [[ "$(uname -m)" == "x86_64"* ]]; then ASSET="$ASSET-x64" elif [[ "$(uname -m)" == "arm64"* ]]; then ASSET="$ASSET-arm64" 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) -# Get current version (if exists) +# Check current version CURRENT_VERSION="" if [[ -f "./tailwindcss" ]]; then CURRENT_VERSION=$(./tailwindcss -v | awk '{print $2}') @@ -31,26 +32,37 @@ fi echo "Current Tailwind version: $CURRENT_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 - echo "Updating Tailwind to latest version..." + echo "โฌ‡๏ธ Downloading latest Tailwind..." rm -f tailwindcss curl -sLO "https://github.com/tailwindlabs/tailwindcss/releases/download/${LATEST_VERSION}/${ASSET}" chmod +x $ASSET mv $ASSET tailwindcss else - echo "Tailwind is already up to date." + echo "โœ… Tailwind is up to date." fi -# Initialize tailwind.config.js if not exists +# Initialize Tailwind config if needed if [[ ! -f "tailwind.config.js" ]]; then - echo "Initializing tailwind.config.js..." + echo "๐Ÿ›  Initializing Tailwind config..." ./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 -# Build Tailwind CSS and Zola -echo "Compiling Tailwind CSS and building Zola site..." -rm -rf public static/css +# Ensure static/css exists +mkdir -p 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 + +# Build Zola site +echo "๐Ÿ— Running Zola..." zola --root "$ABS_DIR_OF_SCRIPT" build + +echo "โœ… Build complete. Check public/ folder." diff --git a/css/index.css b/css/index.css index 09cd099..1a892e3 100644 --- a/css/index.css +++ b/css/index.css @@ -1,14 +1,21 @@ -/*! purgecss start ignore */ -/* @import "nav.css"; */ -/*! purgecss end ignore */ + + @tailwind base; @tailwind components; @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=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');