This commit is contained in:
2024-09-19 11:25:27 +04:00
parent cee756c02d
commit f1f1092e2d
4 changed files with 19 additions and 40 deletions

1
.gitignore vendored
View File

@@ -33,3 +33,4 @@ install*
public public
static/css static/css
tailwindcss tailwindcss
tailwindcss*

View File

@@ -53,13 +53,16 @@ Then clone the repository recursively to also pull in contents of `threefold_dat
curl https://raw.githubusercontent.com/freeflowuniverse/crystallib/development/scripts/install_hero.sh > /tmp/hero_install.sh curl https://raw.githubusercontent.com/freeflowuniverse/crystallib/development/scripts/install_hero.sh > /tmp/hero_install.sh
bash /tmp/hero_install.sh bash /tmp/hero_install.sh
#get this repo be careful --pr will remove all local changes (pull reset) #install zola & tailwind
hero installers -n zola
#get this repo be careful --pr will remove all local changes (pull reset), -b development means we are on the development branch
hero git pull -u https://github.com/threefoldfoundation/www_threefold_io -b development -pr hero git pull -u https://github.com/threefoldfoundation/www_threefold_io -b development -pr
#cd to the directory #cd to the directory
eval $(hero git cd -u https://github.com/threefoldfoundation/www_threefold_io) eval $(hero git cd -u https://github.com/threefoldfoundation/www_threefold_io)
bash build.sh
``` ```

View File

@@ -1,46 +1,22 @@
#/bin/bash
set -ex
echo "Starting build..." echo "Starting build..."
# TODO: Check if current version is latest to avoid redundant installation hero installers -n zola
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
# initialized and configures tailwind if not configured # initialized and configures tailwind if not configured
echo "Initializing tailwind..." echo "Initializing tailwind..."
if [[ ! -f "tailwind.config.js" ]] if [[ ! -f "tailwind.config.js" ]]
then then
./tailwindcss init tailwindcss init
sed -i '' "s| content: \\[\\],| content: \\['./templates/**/*.html'\\],|g" tailwind.config.js sed -i '' "s| content: \\[\\],| content: \\['./templates/**/*.html'\\],|g" tailwind.config.js
fi fi
# compiles tailwind css for prod & builds project # compiles tailwind css for prod & builds project
echo "Compiling tailwindcss and building zola project..." echo "Compiling tailwindcss and building zola project..."
rm -rf public static/css 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 zola build

View File

@@ -1,22 +1,21 @@
# builds if executable isn't foound #/bin/bash
if [ ! -f "tailwindcss" ] set -ex
then
sh build.sh hero installers -n zola
fi
# initialized and configures tailwind if not configured # initialized and configures tailwind if not configured
if [ ! -f "tailwind.config.js" ] if [ ! -f "tailwind.config.js" ]
then then
./tailwindcss init tailwindcss init
sed -i '' "s| content: \\[\\],| content: \\['./templates/**/*.html'\\],|g" tailwind.config.js sed -i '' "s| content: \\[\\],| content: \\['./templates/**/*.html'\\],|g" tailwind.config.js
fi fi
# compiles tailwind css & launches locally # compiles tailwind css & launches locally
rm -rf public static/css rm -rf public static/css
./tailwindcss -i css/index.css -o ./static/css/index.css --watch & zola serve & tailwindcss -i css/index.css -o ./static/css/index.css --watch & zola serve &
# compiles tailwind css for prod & builds project # compiles tailwind css for prod & builds project
./tailwindcss -i css/index.css -o ./static/css/index.css --minify tailwindcss -i css/index.css -o ./static/css/index.css --minify
zola build zola build
# kills zola and tw bg processes on interrupt # kills zola and tw bg processes on interrupt