diff --git a/Classes/Hooks/RenderPreProcessorHook.php b/Classes/Hooks/RenderPreProcessorHook.php index c57ae39..33beea3 100644 --- a/Classes/Hooks/RenderPreProcessorHook.php +++ b/Classes/Hooks/RenderPreProcessorHook.php @@ -134,7 +134,11 @@ public function renderPreProcessorProc(array &$params, PageRenderer $pageRendere $scssFilePath = GeneralUtility::getFileAbsFileName($conf['file']); $pathChunks = explode('/', PathUtility::getAbsoluteWebPath($scssFilePath)); - $assetPath = implode('/', array_splice($pathChunks, 0, 3)) . '/'; + if (self::usesComposerClassLoading()) { + $assetPath = implode('/',array_splice($pathChunks,0,3)).'/'; + } else { + $assetPath = implode('/',array_splice($pathChunks,0,6)).'/'; + } if ($inlineOutput) { $useSourceMap = false; @@ -171,4 +175,9 @@ private function parseBooleanSetting(string $value, bool $defaultValue): bool } return $defaultValue; } + + protected static function usesComposerClassLoading(): bool + { + return defined('TYPO3_COMPOSER_MODE') && TYPO3_COMPOSER_MODE; + } } diff --git a/Classes/ViewHelpers/Asset/ScssViewHelper.php b/Classes/ViewHelpers/Asset/ScssViewHelper.php index 7c84ba9..e31f71f 100644 --- a/Classes/ViewHelpers/Asset/ScssViewHelper.php +++ b/Classes/ViewHelpers/Asset/ScssViewHelper.php @@ -126,7 +126,11 @@ public function render(): string throw new ContentRenderingException('Could not resolve the path to the SCSS file. Probably the path is not correct! Path: '.$file); } $pathChunks = explode('/',PathUtility::getAbsoluteWebPath($scssFilePath)); - $assetPath = implode('/',array_splice($pathChunks,0,3)).'/'; + if (self::usesComposerClassLoading()) { + $assetPath = implode('/',array_splice($pathChunks,0,3)).'/'; + } else { + $assetPath = implode('/',array_splice($pathChunks,0,6)).'/'; + } $variables['extAssetPath'] = $assetPath; $cssFile = Compiler::compileFile($file, $variables, $outputFile); @@ -166,4 +170,9 @@ private function cleanVariables($variables): array return $variables; } + protected static function usesComposerClassLoading(): bool + { + return defined('TYPO3_COMPOSER_MODE') && TYPO3_COMPOSER_MODE; + } + }