@@ -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,8 +126,21 @@ 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
+ '/ ' . 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
+ }
127
141
}
128
142
}
143
+
129
144
return $ urlMap ;
130
145
}
131
146
0 commit comments