Skip to content

Commit

Permalink
Fixed issues with wrong relative URLs in minified CSS if the template…
Browse files Browse the repository at this point in the history
… is processed in /_admin/index.php after clearing the cache.
  • Loading branch information
parpalak committed Sep 24, 2024
1 parent 5e4924f commit 7cb5e16
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions _include/src/Asset/AssetMerge.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,13 +57,15 @@ private function dumpContent(): void
foreach ($this->filesToMerge as $fileToMerge) {
$minifier->add($fileToMerge);
}
$content = $minifier->minify($this->getDumpFilename());
// Taking realpath here since there are some bugs in dependency for relative paths
$content = $minifier->minify($this->getDumpFilename(true));
} elseif ($this->type === self::TYPE_JS) {
$minifier = new Minify\JS();
foreach ($this->filesToMerge as $fileToMerge) {
$minifier->add($fileToMerge);
}
$content = $minifier->minify($this->getDumpFilename());
// Taking realpath here since there are some bugs in dependency for relative paths
$content = $minifier->minify($this->getDumpFilename(true));
} else {
$content = $this->getConcatenatedContent();
}
Expand Down Expand Up @@ -94,9 +96,9 @@ private function needToDump(): bool
return false;
}

private function getDumpFilename(): string
private function getDumpFilename(bool $realPath = false): string
{
return sprintf('%s%s', $this->publicCacheDir, $this->getFilename());
return sprintf('%s%s', $realPath ? realpath($this->publicCacheDir) . '/' : $this->publicCacheDir, $this->getFilename());
}

private function getHashFilename(): string
Expand Down

0 comments on commit 7cb5e16

Please sign in to comment.