Skip to content

Instantly share code, notes, and snippets.

@leonid-shevtsov
Created November 19, 2023 22:20
Show Gist options
  • Save leonid-shevtsov/1f6e8346ff474ac829380a32ff1548c4 to your computer and use it in GitHub Desktop.
Save leonid-shevtsov/1f6e8346ff474ac829380a32ff1548c4 to your computer and use it in GitHub Desktop.
#!/bin/bash
FILES=$(find content static -iname '*.jpg' -size '+1000000c' | comm -23 - .jpegoptimignore)
if [[ $1 = 'do' ]]; then
jpegoptim --strip-com --strip-exif --strip-iptc --size=920 $FILES
else
# lint
if [[ -n "$FILES" ]]; then
echo "Some JPEG files are over 1000000:"
echo -e "$FILES";
exit 1;
else
exit 0;
fi
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment