@@ -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