@@ -69,6 +69,7 @@ public function process(Package $package, array $options)
69
69
/** @var PackageFile $file */
70
70
foreach (array_keys ($ package ->getMap ()) as $ fileId ) {
71
71
$ filePath = str_replace (\Magento \Framework \View \Asset \Repository::FILE_ID_SEPARATOR , '/ ' , $ fileId );
72
+ // phpcs:ignore Magento2.Functions.DiscouragedFunction
72
73
if (strtolower (pathinfo ($ fileId , PATHINFO_EXTENSION )) == 'css ' ) {
73
74
$ urlMap = $ this ->parseCss (
74
75
$ urlMap ,
@@ -100,6 +101,7 @@ private function parseCss(array $urlMap, $cssFilePath, $packagePath, $cssContent
100
101
{
101
102
$ cssFilePath = $ this ->minification ->addMinifiedSign ($ cssFilePath );
102
103
104
+ // phpcs:ignore Magento2.Functions.DiscouragedFunction
103
105
$ cssFileBasePath = pathinfo ($ cssFilePath , PATHINFO_DIRNAME );
104
106
$ urls = $ this ->getCssUrls ($ cssContent );
105
107
foreach ($ urls as $ url ) {
@@ -124,6 +126,22 @@ private function parseCss(array $urlMap, $cssFilePath, $packagePath, $cssContent
124
126
. str_repeat ('../ ' , count (explode ('/ ' , $ cssFileBasePath )))
125
127
. $ this ->minification ->addMinifiedSign ($ matchedFile ->getDeployedFilePath ())
126
128
];
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
+ }
127
145
}
128
146
}
129
147
return $ urlMap ;
0 commit comments