This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
find ./public/images -type f \( -iname \*.jpg -o -iname \*.png -o -iname \*.svg \) | xargs -I % sh -c 'imagemin % -o $(dirname % | sed --expression="s/public/&\/optimized/")' | |
# `find` - Look for files in the specified path | |
# -type f - Filter the files to only include regular files | |
# \( \) - Group statements so that the previous flag (-type f) applies to all following statements | |
# -iname - Look for files with specified names, case insensitive | |
# -o - OR operand | |
# |