Skip to content

Commit 43fd747

Browse files
MAGETWO-99616: Magento font icons are not loading when deployment optimization is implemented
1 parent db9eaf1 commit 43fd747

File tree

1 file changed

+18
-0
lines changed
  • app/code/Magento/Deploy/Package/Processor/PostProcessor

1 file changed

+18
-0
lines changed

app/code/Magento/Deploy/Package/Processor/PostProcessor/CssUrls.php

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ public function process(Package $package, array $options)
6969
/** @var PackageFile $file */
7070
foreach (array_keys($package->getMap()) as $fileId) {
7171
$filePath = str_replace(\Magento\Framework\View\Asset\Repository::FILE_ID_SEPARATOR, '/', $fileId);
72+
// phpcs:ignore Magento2.Functions.DiscouragedFunction
7273
if (strtolower(pathinfo($fileId, PATHINFO_EXTENSION)) == 'css') {
7374
$urlMap = $this->parseCss(
7475
$urlMap,
@@ -100,6 +101,7 @@ private function parseCss(array $urlMap, $cssFilePath, $packagePath, $cssContent
100101
{
101102
$cssFilePath = $this->minification->addMinifiedSign($cssFilePath);
102103

104+
// phpcs:ignore Magento2.Functions.DiscouragedFunction
103105
$cssFileBasePath = pathinfo($cssFilePath, PATHINFO_DIRNAME);
104106
$urls = $this->getCssUrls($cssContent);
105107
foreach ($urls as $url) {
@@ -124,6 +126,22 @@ private function parseCss(array $urlMap, $cssFilePath, $packagePath, $cssContent
124126
. str_repeat('../', count(explode('/', $cssFileBasePath)))
125127
. $this->minification->addMinifiedSign($matchedFile->getDeployedFilePath())
126128
];
129+
} else {
130+
$filePathInBase = $package->getArea() .
131+
'/' .
132+
Package::BASE_THEME .
133+
'/' .
134+
$package->getLocale() .
135+
'/' .
136+
$lookupFileId;
137+
if ($this->staticDir->isReadable($this->minification->addMinifiedSign($filePathInBase))) {
138+
$urlMap[$url][] = [
139+
'filePath' => $this->minification->addMinifiedSign($packagePath . '/' . $cssFilePath),
140+
'replace' => '../../../../' // base path is always of four chunks size
141+
. str_repeat('../', count(explode('/', $cssFileBasePath)))
142+
. $this->minification->addMinifiedSign($filePathInBase)
143+
];
144+
}
127145
}
128146
}
129147
return $urlMap;

0 commit comments

Comments
 (0)