| 1 | #!/usr/bin/env bash |
| 2 | found=0 |
| 3 | |
| 4 | for svgfile in `find resources -type f -name "*.svg"`; do |
| 5 | outfile="$svgfile.tmp" |
| 6 | echo -n "Checking compression: $svgfile ... " |
| 7 | node_modules/.bin/svgo --config .svgo.config.js -i "$svgfile" -o "$outfile" -q |
| 8 | if [ -f $outfile ]; then |
| 9 | if [ "$(wc -c < "$svgfile")" -gt "$(wc -c < "$outfile")" ]; then |
| 10 | echo "File $svgfile is not compressed." |
| 11 | found=$((found + 1)) |
| 12 | fi |
| 13 | rm "$outfile" |
| 14 | fi |
| 15 | done |
| 16 | |
| 17 | if [ $found -gt 0 ]; then |
| 18 | echo "Found $found uncompressed SVG files. Please compress the files and re-submit the patch." |
| 19 | exit 1 |
| 20 | fi |