fix(build): Ignore `default-source.svg` from image optimization

Signed-off-by: Joas Schilling <coding@schilljs.com>
This commit is contained in:
Joas Schilling 2023-09-25 16:40:03 +02:00
parent bbfa9d1440
commit 625d9bd47c
No known key found for this signature in database
GPG Key ID: 74434EFE0D2E2205
1 changed files with 16 additions and 11 deletions

View File

@ -4,17 +4,17 @@ set -e
OPTIPNG=$(which optipng)
if ! [ -x "$OPTIPNG" ]; then
echo "optipng executable not found, please install" >&2
echo -e "\033[0;31moptipng executable not found, please install\033[0m" >&2
exit 1
fi
JPEGOPTIM=$(which jpegoptim)
if ! [ -x "$JPEGOPTIM" ]; then
echo "jpegoptim executable not found, please install" >&2
echo -e "\033[0;31mjpegoptim executable not found, please install\033[0m" >&2
exit 2
fi
SCOUR=$(which scour)
if ! [ -x "$SCOUR" ]; then
echo "scour executable not found, please install" >&2
echo -e "\033[0;31mscour executable not found, please install\033[0m" >&2
exit 3
fi
@ -37,25 +37,25 @@ function recursive_optimize_images() {
DIR_NAME=${PWD##*/}
if [[ "$DIR_NAME" == "3rdparty" ]]; then
echo "Ignoring 3rdparty for image optimization"
echo -e "\033[0;36mIgnoring 3rdparty for image optimization\033[0m"
return
elif [[ "$DIR_NAME" == "build" ]]; then
echo "Ignoring build for image optimization"
echo -e "\033[0;36mIgnoring build for image optimization\033[0m"
return
elif [[ "$DIR_NAME" == "cypress" ]]; then
echo "Ignoring cypress for image optimization"
echo -e "\033[0;36mIgnoring cypress for image optimization\033[0m"
return
elif [[ "$DIR_NAME" == "node_modules" ]]; then
echo "Ignoring node_modules for image optimization"
echo -e "\033[0;36mIgnoring node_modules for image optimization\033[0m"
return
elif [[ "$DIR_NAME" == "tests" ]]; then
echo "Ignoring tests for image optimization"
echo -e "\033[0;36mIgnoring tests for image optimization\033[0m"
return
elif [[ "$DIR_NAME" == "vendor" ]]; then
echo "Ignoring vendor for image optimization"
echo -e "\033[0;36mIgnoring vendor for image optimization\033[0m"
return
elif [[ "$DIR_NAME" == "vendor-bin" ]]; then
echo "Ignoring vendor-bin for image optimization"
echo -e "\033[0;36mIgnoring vendor-bin for image optimization\033[0m"
return
fi
@ -80,6 +80,11 @@ function recursive_optimize_images() {
do
[[ -e "$svg" ]] || break
if [[ "$svg" == "default-source.svg" ]]; then
echo -e "\033[0;36mIgnoring $svg image optimization\033[0m"
continue
fi
mv $svg $svg.opttmp
$SCOUR --create-groups \
--enable-id-stripping \
@ -100,7 +105,7 @@ function recursive_optimize_images() {
if [[ -d "$dir" ]]; then
if git check-ignore $dir -q ; then
echo "$dir is not shipped. Ignoring image optimization"
echo -e "\033[0;36m$dir is not shipped. Ignoring image optimization\033[0m"
continue
fi