Created
October 18, 2023 17:00
-
-
Save Git-I985/f0eee4a799bc0a3e38128b8faf244115 to your computer and use it in GitHub Desktop.
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
# step 1. find all uncommitted/changed images in sources dir and copy them to the buffer dir | |
for file in $(git status -s | cut -c4- | grep .png) | |
do | |
echo $file; | |
mkdir -p "./to_optimize/$(dirname $file)"; | |
cp $file "./to_optimize/$file"; | |
done | |
# step 2. optimize files in buffer dir by some third party service | |
# step 3. copy files from buffer dir back to the sources dir | |
for file in $(find "./to_optimize" -name "*.png") | |
do | |
cp $file ${file#"./to_optimize/"}; | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment