46 lines
1.2 KiB
Bash
Executable File
46 lines
1.2 KiB
Bash
Executable File
#!/bin/bash
|
|
|
|
# Script to apply Tailwind theme to index.css
|
|
# Usage: bash apply-theme.sh <frontend-directory>
|
|
# Example: bash apply-theme.sh frontend
|
|
|
|
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
THEME_FILE="$SCRIPT_DIR/../assets/tailwind-theme.css"
|
|
|
|
# Check if frontend directory argument provided
|
|
if [ -z "$1" ]; then
|
|
echo "Error: Please provide the frontend directory path"
|
|
echo "Usage: bash apply-theme.sh <frontend-directory>"
|
|
echo "Example: bash apply-theme.sh frontend"
|
|
exit 1
|
|
fi
|
|
|
|
TARGET_DIR="$1"
|
|
TARGET_FILE="$TARGET_DIR/src/index.css"
|
|
|
|
# Check if target file exists
|
|
if [ ! -f "$TARGET_FILE" ]; then
|
|
echo "Error: $TARGET_FILE not found."
|
|
echo "Make sure '$TARGET_DIR' is the correct frontend directory path."
|
|
exit 1
|
|
fi
|
|
|
|
# Check if theme file exists
|
|
if [ ! -f "$THEME_FILE" ]; then
|
|
echo "Error: Theme file not found at $THEME_FILE"
|
|
exit 1
|
|
fi
|
|
|
|
# Check if theme already applied
|
|
if grep -q "Base Theme Configuration" "$TARGET_FILE"; then
|
|
echo "Theme already appears to be applied to $TARGET_FILE"
|
|
echo "Skipping to avoid duplication."
|
|
exit 0
|
|
fi
|
|
|
|
# Append theme to index.css
|
|
echo "" >> "$TARGET_FILE"
|
|
cat "$THEME_FILE" >> "$TARGET_FILE"
|
|
|
|
echo "✓ Tailwind theme successfully applied to $TARGET_FILE"
|