Merge "build: Unify 'svg_check.sh'"

This commit is contained in:
jenkins-bot 2021-04-30 20:39:35 +00:00 committed by Gerrit Code Review
commit ef77761e6d

View file

@ -1,18 +1,18 @@
#!/usr/bin/env bash #!/usr/bin/env bash
found=0 found=0
while read -r svgfile; do for svgfile in `find resources -type f -name "*.svg"`; do
outfile="$svgfile.tmp" outfile="$svgfile.tmp"
echo -n "Checking compression: $svgfile ... " echo -n "Checking compression: $svgfile ... "
node_modules/.bin/svgo --config .svgo.config.js -i "$svgfile" -o "$outfile" -q node_modules/.bin/svgo --config .svgo.config.js -i "$svgfile" -o "$outfile" -q
if [ "$(wc -c < "$svgfile")" -gt "$(wc -c < "$outfile")" ]; then if [ -f $outfile ]; then
echo -e "\nERR> file $svgfile is not compressed." if [ "$(wc -c < "$svgfile")" -gt "$(wc -c < "$outfile")" ]; then
found=$((found + 1)) echo "File $svgfile is not compressed."
else found=$((found + 1))
echo "OK" fi
rm "$outfile"
fi fi
rm "$outfile" done
done < <(find resources -type f -name '*.svg')
if [ $found -gt 0 ]; then if [ $found -gt 0 ]; then
echo "Found $found uncompressed SVG files. Please compress the files and re-submit the patch." echo "Found $found uncompressed SVG files. Please compress the files and re-submit the patch."