feat: Add webp convertion

This commit is contained in:
Simon 2021-05-12 08:42:53 +02:00
parent 22e23b0162
commit 08c42b16fa
3 changed files with 211 additions and 542 deletions

750
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -5,6 +5,7 @@
"license": "GPL-3.0",
"dependencies": {
"imagemin-cli": "^6.0.0",
"imagemin-webp": "^6.0.0",
"richtypo": "4.0.7",
"richtypo-rules-common": "4.0.2",
"richtypo-rules-fr": "4.0.2"

View File

@ -84,7 +84,7 @@ optimizer() {
echo "🖼️ Optimisation des images"
echo
# $SCRIPT_DIR/../node_modules/.bin/imagemin $PWD/static -o $PWD/static
find ./static ./content -type f | xargs -I % bash -c '$0/../node_modules/.bin/imagemin % -o $(dirname %)' $SCRIPT_DIR
find ./static ./content -type f \( -iname \*.jpg \) | xargs -I % bash -c '$0/../node_modules/.bin/imagemin % --plugin.webp.quality=95 > $(dirname %)/$(basename % | sed "s/\(.*\)\..*/\1/").webp' $SCRIPT_DIR
}
optimizer_git_image() {