diff --git a/.gitignore b/.gitignore index 415604bf8..80c0ca7f1 100644 --- a/.gitignore +++ b/.gitignore @@ -33,3 +33,4 @@ install* public static/css tailwindcss +tailwindcss* \ No newline at end of file diff --git a/README.md b/README.md index c30657880..5651b7cf6 100644 --- a/README.md +++ b/README.md @@ -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 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 #cd to the directory eval $(hero git cd -u https://github.com/threefoldfoundation/www_threefold_io) - +bash build.sh ``` diff --git a/build.sh b/build.sh index d4e42ff48..51ae957b2 100755 --- a/build.sh +++ b/build.sh @@ -1,46 +1,22 @@ +#/bin/bash +set -ex + 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 diff --git a/start.sh b/start.sh index 4a8094af7..ef6e714bb 100755 --- a/start.sh +++ b/start.sh @@ -1,22 +1,21 @@ -# builds if executable isn't foound -if [ ! -f "tailwindcss" ] -then - sh build.sh -fi +#/bin/bash +set -ex + +hero installers -n zola # initialized and configures tailwind if not configured 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 & launches locally 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 -./tailwindcss -i css/index.css -o ./static/css/index.css --minify +tailwindcss -i css/index.css -o ./static/css/index.css --minify zola build # kills zola and tw bg processes on interrupt