@@ -102,21 +102,7 @@ public function process($root, $file, $app) {
102102 $ fileNameCSS = $ this ->prependBaseurlPrefix (str_replace ('.scss ' , '.css ' , $ fileNameSCSS ));
103103
104104 $ path = implode ('/ ' , $ path );
105- $ webDir = null ;
106-
107- // Detect if path is within an app path
108- $ app_paths = $ this ->config ->getSystemValue ('apps_paths ' );
109- if (!empty ($ app_paths )) {
110- foreach ($ app_paths as $ app_path ) {
111- if (strpos ($ path , $ app_path ["path " ]) === 0 ) {
112- $ webDir = $ app_path ["url " ].str_replace ($ app_path ["path " ], '' , $ path );
113- break ;
114- }
115- }
116- }
117- if (is_null ($ webDir )) {
118- $ webDir = substr ($ path , strlen ($ this ->serverRoot ));
119- }
105+ $ webDir = $ this ->getWebDir ($ path );
120106
121107 try {
122108 $ folder = $ this ->appData ->getFolder ($ app );
@@ -323,4 +309,22 @@ private function prependBaseurlPrefix($cssFile) {
323309 $ frontendController = ($ this ->config ->getSystemValue ('htaccess.IgnoreFrontController ' , false ) === true || getenv ('front_controller_active ' ) === 'true ' );
324310 return substr (md5 ($ this ->urlGenerator ->getBaseUrl () . $ frontendController ), 0 , 8 ) . '- ' . $ cssFile ;
325311 }
312+
313+ /**
314+ * Prepend hashed base url to the css file
315+ * @param string $path the css file path
316+ * @return string the webDir
317+ */
318+ private function getWebDir ($ path ) {
319+ // Detect if path is within an app path
320+ $ app_paths = $ this ->config ->getSystemValue ('apps_paths ' );
321+ if (!empty ($ app_paths )) {
322+ foreach ($ app_paths as $ app_path ) {
323+ if (strpos ($ path , $ app_path ["path " ]) === 0 ) {
324+ return $ app_path ["url " ].str_replace ($ app_path ["path " ], '' , $ path );
325+ }
326+ }
327+ }
328+ return substr ($ path , strlen ($ this ->serverRoot ));
329+ }
326330}
0 commit comments