forked from vinceliuice/Fluent-gtk-theme
-
Notifications
You must be signed in to change notification settings - Fork 0
/
parse-sass.sh
executable file
·61 lines (49 loc) · 1.68 KB
/
parse-sass.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
#!/bin/bash
if [[ ! "$(command -v sassc)" ]]; then
echo "'sassc' needs to be installed to generate the CSS."
exit 1
fi
SASSC_OPT=('-M' '-t' 'expanded')
_COLOR_VARIANTS=('' '-light' '-dark')
_SIZE_VARIANTS=('' '-compact')
if [[ -n "${COLOR_VARIANTS:-}" ]]; then
IFS=', ' read -r -a _COLOR_VARIANTS <<< "${COLOR_VARIANTS:-}"
fi
if [[ -n "${SIZE_VARIANTS:-}" ]]; then
IFS=', ' read -r -a _SIZE_VARIANTS <<< "${SIZE_VARIANTS:-}"
fi
# Check command avalibility
function has_command() {
command -v $1 > /dev/null
}
# Install needed packages
install_package() {
if [ ! "$(which sassc 2> /dev/null)" ]; then
echo sassc needs to be installed to generate the css.
if has_command zypper; then
sudo zypper in sassc
elif has_command apt-get; then
sudo apt-get install sassc
elif has_command dnf; then
sudo dnf install sassc
elif has_command dnf; then
sudo dnf install sassc
elif has_command pacman; then
sudo pacman -S --noconfirm sassc
fi
fi
}
echo "== Generating the CSS..."
install_package
cp -rf src/_sass/_tweaks.scss src/_sass/_tweaks-temp.scss
cp -rf src/gnome-shell/sass/_tweaks.scss src/gnome-shell/sass/_tweaks-temp.scss
for color in "${_COLOR_VARIANTS[@]}"; do
for size in "${_SIZE_VARIANTS[@]}"; do
sassc "${SASSC_OPT[@]}" "src/gtk/3.0/gtk$color$size."{scss,css}
sassc "${SASSC_OPT[@]}" "src/gtk/4.0/gtk$color$size."{scss,css}
sassc "${SASSC_OPT[@]}" "src/gnome-shell/shell-3-28/gnome-shell$color$size."{scss,css}
sassc "${SASSC_OPT[@]}" "src/gnome-shell/shell-40-0/gnome-shell$color$size."{scss,css}
sassc "${SASSC_OPT[@]}" "src/cinnamon/cinnamon$color$size."{scss,css}
done
done
echo "== done!"