Skip to content

Commit

Permalink
feat: catch minify error
Browse files Browse the repository at this point in the history
  • Loading branch information
BernhardBaumrock committed May 6, 2024
1 parent 5948224 commit 8404bc3
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions RockFrontend.module.php
Original file line number Diff line number Diff line change
Expand Up @@ -1766,10 +1766,14 @@ public function minifyFile($file, $minFile = null): string
if (!$minFile) $minFile = $file->minPath();
$minFile = new Asset($minFile);
if ($minFile->m < $file->m) {
require_once __DIR__ . "/vendor/autoload.php";
if ($file->ext == 'js') $minify = new \MatthiasMullie\Minify\JS($file);
else $minify = new \MatthiasMullie\Minify\CSS($file);
$minify->minify($minFile->path);
try {
require_once __DIR__ . "/vendor/autoload.php";
if ($file->ext == 'js') $minify = new \MatthiasMullie\Minify\JS($file);
else $minify = new \MatthiasMullie\Minify\CSS($file);
$minify->minify($minFile->path);
} catch (\Throwable $th) {
$this->log($th->getMessage());
}
}
return $minFile->path;
}
Expand Down

0 comments on commit 8404bc3

Please sign in to comment.