parse-sass.sh 1.34 KB
Newer Older
vinceliuice's avatar
vinceliuice committed
1 2
#! /bin/bash

r0b1ns's avatar
r0b1ns committed
3 4
REPO_DIR=$(cd $(dirname $0) && pwd)

vinceliuice's avatar
vinceliuice committed
5 6 7 8 9
# check command avalibility
has_command() {
  "$1" -v $1 > /dev/null 2>&1
}

vinceliuice's avatar
vinceliuice committed
10
if [ ! "$(which sassc 2> /dev/null)" ]; then
vinceliuice's avatar
vinceliuice committed
11 12 13 14 15 16 17 18 19 20 21 22
  echo sassc needs to be installed to generate the css.
  if has_command zypper; then
    sudo zypper in sassc
  elif has_command apt; then
    sudo apt install sassc
  elif has_command dnf; then
    sudo dnf install -y sassc
  elif has_command yum; then
    sudo yum install sassc
  elif has_command pacman; then
    sudo pacman -S --noconfirm sassc
  fi
vinceliuice's avatar
vinceliuice committed
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38
fi

SASSC_OPT="-M -t expanded"

_COLOR_VARIANTS=('-light' '-dark')
if [ ! -z "${COLOR_VARIANTS:-}" ]; then
  IFS=', ' read -r -a _COLOR_VARIANTS <<< "${COLOR_VARIANTS:-}"
fi

_TRANS_VARIANTS=('' '-solid')
if [ ! -z "${TRANS_VARIANTS:-}" ]; then
  IFS=', ' read -r -a _TRANS_VARIANTS <<< "${TRANS_VARIANTS:-}"
fi

for color in "${_COLOR_VARIANTS[@]}"; do
  for trans in "${_TRANS_VARIANTS[@]}"; do
r0b1ns's avatar
r0b1ns committed
39
    sassc $SASSC_OPT $REPO_DIR/src/main/gtk-3.0/gtk${color}${trans}.{scss,css}
vinceliuice's avatar
vinceliuice committed
40
    echo "==> Generating the gtk${color}${trans}.css..."
r0b1ns's avatar
r0b1ns committed
41
    sassc $SASSC_OPT $REPO_DIR/src/main/gnome-shell/gnome-shell${color}${trans}.{scss,css}
42
    echo "==> Generating the gnome-shell${color}${trans}.css..."
r0b1ns's avatar
r0b1ns committed
43
    sassc $SASSC_OPT $REPO_DIR/src/main/cinnamon/cinnamon${color}${trans}.{scss,css}
44
    echo "==> Generating the cinnamon${color}${trans}.css..."
vinceliuice's avatar
vinceliuice committed
45 46
  done
done