Skip to content

Commit 3db84d2

Browse files
committed
Merge remote-tracking branch 'origin/MAGETWO-99616' into 2.3-develop-pr24
2 parents ebc043c + 7ea0987 commit 3db84d2

File tree

1 file changed

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

1 file changed

+15
-0
lines changed

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

Lines changed: 15 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,8 +126,21 @@ 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+
'/' . Package::BASE_THEME .
132+
'/' . $package->getLocale() .
133+
'/' . $lookupFileId;
134+
if ($this->staticDir->isReadable($this->minification->addMinifiedSign($filePathInBase))) {
135+
$urlMap[$url][] = [
136+
'filePath' => $this->minification->addMinifiedSign($packagePath . '/' . $cssFilePath),
137+
'replace' => str_repeat('../', count(explode('/', $cssFileBasePath)) + 4)
138+
. $this->minification->addMinifiedSign($filePathInBase),
139+
];
140+
}
127141
}
128142
}
143+
129144
return $urlMap;
130145
}
131146

0 commit comments

Comments
 (0)