2017-07-13 15:56:30 +00:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
found=0
|
|
|
|
|
2017-12-11 15:42:51 +00:00
|
|
|
while read -r svgfile; do
|
2017-08-30 10:22:40 +00:00
|
|
|
outfile="$svgfile.tmp"
|
2017-12-11 15:50:56 +00:00
|
|
|
echo -n "Checking compression: $svgfile ... "
|
2021-04-12 20:24:01 +00:00
|
|
|
node_modules/.bin/svgo --config .svgo.config.js -i "$svgfile" -o "$outfile" -q
|
2017-12-11 15:42:51 +00:00
|
|
|
if [ "$(wc -c < "$svgfile")" -gt "$(wc -c < "$outfile")" ]; then
|
2017-12-11 15:50:56 +00:00
|
|
|
echo -e "\nERR> file $svgfile is not compressed."
|
2017-08-30 10:22:40 +00:00
|
|
|
found=$((found + 1))
|
2017-12-11 15:50:56 +00:00
|
|
|
else
|
|
|
|
echo "OK"
|
2017-08-30 10:22:40 +00:00
|
|
|
fi
|
|
|
|
rm "$outfile"
|
2017-12-11 15:42:51 +00:00
|
|
|
done < <(find resources -type f -name '*.svg')
|
2017-07-13 15:56:30 +00:00
|
|
|
|
|
|
|
if [ $found -gt 0 ]; then
|
2017-08-30 10:22:40 +00:00
|
|
|
echo "Found $found uncompressed SVG files. Please compress the files and re-submit the patch."
|
|
|
|
exit 1
|
|
|
|
fi
|