aboutsummaryrefslogtreecommitdiffstats
path: root/build/image-optimization.sh
diff options
context:
space:
mode:
Diffstat (limited to 'build/image-optimization.sh')
-rwxr-xr-xbuild/image-optimization.sh32
1 files changed, 20 insertions, 12 deletions
diff --git a/build/image-optimization.sh b/build/image-optimization.sh
index 01af95c97b9..ddb213ea5bb 100755
--- a/build/image-optimization.sh
+++ b/build/image-optimization.sh
@@ -1,20 +1,23 @@
#!/usr/bin/env bash
-
+#
+# SPDX-FileCopyrightText: 2017 Nextcloud GmbH and Nextcloud contributors
+# SPDX-License-Identifier: AGPL-3.0-or-later
+#
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 +40,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 +83,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 +108,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