57 lines
1.9 KiB
Bash
Executable File
57 lines
1.9 KiB
Bash
Executable File
PREFIX="mycelium"
|
|
|
|
echo "Starting build..."
|
|
|
|
SOURCE=${BASH_SOURCE[0]}
|
|
DIR_OF_THIS_SCRIPT="$( dirname "$SOURCE" )"
|
|
ABS_DIR_OF_SCRIPT="$( realpath $DIR_OF_THIS_SCRIPT )"
|
|
|
|
# Check if tailwindcss executable exists, if not, download and install it
|
|
if [[ ! -f "tailwindcss" ]]; then
|
|
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/download/v3.4.17/${ASSET}"
|
|
chmod +x $ASSET
|
|
mv $ASSET tailwindcss
|
|
else
|
|
echo "tailwindcss already exists, skipping installation."
|
|
fi
|
|
|
|
|
|
# initialized and configures tailwind if not configured
|
|
echo "Initializing tailwind..."
|
|
if [[ ! -f "tailwind.config.js" ]]
|
|
then
|
|
./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
|
|
|
|
|
|
# echo "Building without prefix..."
|
|
# sed 's|base_url = "BASEURL"|base_url = "https://www.mycelium.threefold.io/"|' config.templ.toml > config.toml
|
|
# zola --root $ABS_DIR_OF_SCRIPT build
|
|
# rsync -avz --delete public/ "root@threefold.info:/root/hero/www/info/$PREFIX/"
|
|
|
|
echo "Building with prefix: /$PREFIX/"
|
|
sed 's|base_url = "BASEURL"|base_url = "/mycelium/"|' config.templ.toml > config.toml
|
|
zola --root $ABS_DIR_OF_SCRIPT build
|
|
rsync -rav --delete public/ "${HOME}/hero/var/www/$PREFIX/"
|
|
rsync -avz --delete public/ "root@threefold.info:/root/hero/www/info/$PREFIX/"
|