Skip to content

Commit

Permalink
Merge pull request #81 from WapplerSystems/feature/classic-mode
Browse files Browse the repository at this point in the history
classic mode support
  • Loading branch information
svewap authored Feb 23, 2024
2 parents d607990 + da8f6a5 commit 772c1c1
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 2 deletions.
11 changes: 10 additions & 1 deletion Classes/Hooks/RenderPreProcessorHook.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
}
}
11 changes: 10 additions & 1 deletion Classes/ViewHelpers/Asset/ScssViewHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -166,4 +170,9 @@ private function cleanVariables($variables): array
return $variables;
}

protected static function usesComposerClassLoading(): bool
{
return defined('TYPO3_COMPOSER_MODE') && TYPO3_COMPOSER_MODE;
}

}

0 comments on commit 772c1c1

Please sign in to comment.