Skip to content

Commit

Permalink
[BUGFIX] Image Minify: Skip files without minifier
Browse files Browse the repository at this point in the history
Early return for all files which have no minifier set,
to avoid fatal error with ambigous error message
“Minifier method  cannot be found!”.
For example when webp images exist in the image directory.
The files are added to the error list right away,
to that the task may continue to minify other images and
show a result message (“Minified X of Y files”) at the end.
  • Loading branch information
pixelbrackets committed Nov 10, 2021
1 parent 88b61be commit a0a1e5e
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/Task/Assets/ImageMinify.php
Original file line number Diff line number Diff line change
Expand Up @@ -389,6 +389,12 @@ protected function minify($files)
$minifier = 'svgo';
break;
}

// Skip files without available minifier
if ($minifier === '') {
$this->results['error'][] = $from;
continue;
}
} else {
if (!in_array($this->minifier, $this->minifiers, true)
&& !is_callable(strtr($this->minifier, '-', '_'))
Expand Down

0 comments on commit a0a1e5e

Please sign in to comment.