2017-07-13 15:56:30 +00:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
found=0
|
|
|
|
|
2017-08-30 10:22:40 +00:00
|
|
|
find resources -type f -name '*.svg' |
|
|
|
|
while read svgfile; do
|
|
|
|
outfile="$svgfile.tmp"
|
|
|
|
node_modules/.bin/svgo --config .svgo.yml -i "$svgfile" -o "$outfile" -q
|
|
|
|
if [ $(wc -c < "$svgfile") -gt $(wc -c < "$outfile") ]; then
|
|
|
|
echo "File $svgfile is not compressed."
|
|
|
|
found=$((found + 1))
|
|
|
|
fi
|
|
|
|
rm "$outfile"
|
2017-07-13 15:56:30 +00:00
|
|
|
done
|
|
|
|
|
|
|
|
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
|