diff --git a/README.md b/README.md index 0e0bf30b1..5651b7cf6 100644 --- a/README.md +++ b/README.md @@ -13,6 +13,7 @@ Staging: www2.threefold.io (development branch) Last Updated: May 2023 ## Administrators + [ThreeFold's Web Admins](https://github.com/orgs/threefoldfoundation/teams/team_web_admin) ## Contribution Procedure @@ -47,8 +48,22 @@ To do that, the following prerequisites are needed: Then clone the repository recursively to also pull in contents of `threefold_data`: -``` -git clone --recursive https://github.com/threefoldfoundation/www_threefold_io.git +```bash +#if you don't have hero installed yet, run the following commands +curl https://raw.githubusercontent.com/freeflowuniverse/crystallib/development/scripts/install_hero.sh > /tmp/hero_install.sh +bash /tmp/hero_install.sh + +#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 + ``` Now run `build.sh` to download Tailwind, build the CSS, and also build the site with Zola: diff --git a/build.sh b/build.sh index d4e42ff48..ce2bbbe51 100755 --- a/build.sh +++ b/build.sh @@ -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 diff --git a/start.sh b/start.sh index 4a8094af7..4d1fa66f1 100755 --- a/start.sh +++ b/start.sh @@ -1,22 +1,24 @@ -# builds if executable isn't foound -if [ ! -f "tailwindcss" ] -then - sh build.sh -fi +#/bin/bash +set -ex + +BASE_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )" +cd ${BASE_DIR} + +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