This commit is contained in:
2024-09-19 12:57:43 +04:00
parent dd653badcb
commit b42f05d4d6
6 changed files with 173 additions and 165 deletions

View File

@@ -1,46 +1,26 @@
#/bin/bash
set -ex
BASE_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )"
cd ${BASE_DIR}
echo "Starting build..."
# TODO: Check if current version is latest to avoid redundant installation
if [[ -f "tailwindcss" ]]
then
echo "Tailwind installed"
else
# rm tailwindcss
# checks os and architecture for correct release
# https://stackoverflow.com/a/8597411
echo "Installing & building tailwind..."
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
curl -sLO "https://github.com/tailwindlabs/tailwindcss/releases/latest/download/${ASSET}"
chmod +x $ASSET
mv $ASSET tailwindcss
fi
hero installers -n zola
# initialized and configures tailwind if not configured
echo "Initializing tailwind..."
if [[ ! -f "tailwind.config.js" ]]
then
./tailwindcss init
tailwindcss init
sed -i '' "s| content: \\[\\],| content: \\['./templates/**/*.html'\\],|g" tailwind.config.js
fi
# compiles tailwind css for prod & builds project
echo "Compiling tailwindcss and building zola project..."
rm -rf public static/css
./tailwindcss -i css/index.css -o ./static/css/index.css --minify
tailwindcss -i css/index.css -o ./static/css/index.css --minify
zola build