Commit 29961f88 authored by Ruben ten Hove's avatar Ruben ten Hove
Browse files

fix: optimize optimizer

parent 3d06f8ba
Loading
Loading
Loading
Loading
+12 −2
Original line number Diff line number Diff line
@@ -9,7 +9,17 @@
# Place these where they are best suited. For example, optimize images _before_
# building your site, so these may be for example gzipped with an efficient size.

variables:
  WEB_OPTIMIZE_IMAGE_FIND_REGEX: .*.jpe?g
  WEB_OPTIMIZE_IMAGE_QUALITY: 85
  WEB_OPTIMIZE_IMAGE_MAX_WIDTH: 2560
  WEB_OPTIMIZE_IMAGE_DEFAULT_ARGS: -strip -interlace Plane

.web:optimize:
  images:
    - find . -type f -name "*.jpg" -o -name "*.jpeg" -exec magick mogrify
      -verbose -strip -interlace Plane -quality 75 -resize 2560x\> {} \;
    - |
      if command -v mogrify >/dev/null; then
        find . -type f -regex ${WEB_OPTIMIZE_FIND_REGEX} -exec mogrify -verbose ${WEB_OPTIMIZE_IMAGE_DEFAULT_ARGS} -quality ${WEB_OPTIMIZE_IMAGE_QUALITY} -resize ${WEB_OPTIMIZE_MAX_WIDTH}x\> {} \;
      else
        echo "[!] Imagemagick not available. Not optimizing images."
      fi