2017-07-13 15:56:30 +00:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
found=0
|
|
|
|
|
2021-04-30 11:39:11 +00:00
|
|
|
for svgfile in `find resources -type f -name "*.svg"`; 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
|
2021-04-30 11:39:11 +00:00
|
|
|
if [ -f $outfile ]; then
|
|
|
|
if [ "$(wc -c < "$svgfile")" -gt "$(wc -c < "$outfile")" ]; then
|
|
|
|
echo "File $svgfile is not compressed."
|
|
|
|
found=$((found + 1))
|
|
|
|
fi
|
|
|
|
rm "$outfile"
|
2017-08-30 10:22:40 +00:00
|
|
|
fi
|
2021-04-30 11:39:11 +00:00
|
|
|
done
|
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
|