Skip to content

Commit

Permalink
Fail early when there is an error in the downloading of a Bootswatch …
Browse files Browse the repository at this point in the history
…theme

Signed-off-by: Martin Tzvetanov Grigorov <[email protected]>
(cherry picked from commit 6c54b09)
Signed-off-by: Martin Tzvetanov Grigorov <[email protected]>
  • Loading branch information
martin-g committed Dec 12, 2024
1 parent a92ad39 commit 9a780af
Showing 1 changed file with 17 additions and 8 deletions.
Original file line number Diff line number Diff line change
@@ -1,23 +1,32 @@
#!/bin/bash

get() {
curl --silent --fail $@
exit_code=$?
if [[ $exit_code > 0 ]]; then
echo "A problem occurred while downloading the theme!"
exit $exit_code
fi
}

downloadTheme() {
theme=$1
version=$2
mkdir -p css

echo "Downloading '$theme@$version"
wget "https://cdn.jsdelivr.net/npm/bootswatch@$version/dist/$theme/_variables.scss" -O css/bootstrap.$theme.variables.scss
wget "https://cdn.jsdelivr.net/npm/bootswatch@$version/dist/$theme/_bootswatch.scss" -O css/bootstrap.$theme.scss
wget "https://cdn.jsdelivr.net/npm/bootswatch@$version/dist/$theme/bootstrap.min.css" -O css/bootstrap.$theme.min.css
wget "https://cdn.jsdelivr.net/npm/bootswatch@$version/dist/$theme/bootstrap.css" -O css/bootstrap.$theme.css
wget "https://cdn.jsdelivr.net/npm/bootswatch@$version/dist/$theme/bootstrap.rtl.min.css" -O css/bootstrap.rtl.$theme.min.css
wget "https://cdn.jsdelivr.net/npm/bootswatch@$version/dist/$theme/bootstrap.rtl.css" -O css/bootstrap.rtl.$theme.css
echo "Downloading $theme@$version"
get "https://cdn.jsdelivr.net/npm/bootswatch@$version/dist/$theme/_variables.scss" -o css/bootstrap.$theme.variables.scss
get "https://cdn.jsdelivr.net/npm/bootswatch@$version/dist/$theme/_bootswatch.scss" -o css/bootstrap.$theme.scss
get "https://cdn.jsdelivr.net/npm/bootswatch@$version/dist/$theme/bootstrap.min.css" -o css/bootstrap.$theme.min.css
get "https://cdn.jsdelivr.net/npm/bootswatch@$version/dist/$theme/bootstrap.css" -o css/bootstrap.$theme.css
get "https://cdn.jsdelivr.net/npm/bootswatch@$version/dist/$theme/bootstrap.rtl.min.css" -o css/bootstrap.rtl.$theme.min.css
get "https://cdn.jsdelivr.net/npm/bootswatch@$version/dist/$theme/bootstrap.rtl.css" -o css/bootstrap.rtl.$theme.css

echo -e "@import \"../../bootstrap/css/bootstrap.scss\";\n@import \"bootstrap.$theme.variables.scss\";\n\n" | cat - css/bootstrap.$theme.scss > tmp.$theme.out && mv tmp.$theme.out css/bootstrap.$theme.scss
}

for theme in cerulean cosmo cyborg darkly flatly journal litera lumen lux materia minty morph pulse quartz sandstone simplex sketchy slate solar spacelab superhero united vapor yeti zephyr
do
downloadTheme $theme 'v5.3.3' 2>&1 & >/dev/null
downloadTheme $theme 'v5.3.3'
done

0 comments on commit 9a780af

Please sign in to comment.