Issue Bug Closed

#84261PageRenderer Includes and config.compress/concatenate CSS/JS does not work

Paul Beck 03/14/18, 13:54 updated 10/02/18, 10:51

Description

When including JS and CSS files using the Pagerenderer in some Extbase actions the config.compress/concatenate function will break with a WARNING.

Example include in an Extbase Controller Action:

$pageRenderer = $this->objectManager->get(\TYPO3\CMS\Core\Page\PageRenderer::class);
$pageRenderer->addJsFooterFile('EXT:myext/Resources/Public/Javascripts/my.js');

Then enable the compression in the Typoscript configuration and you will get this warning:

file_get_contents(/home/www/p123456789/html/typo3conf/ext/myext/Resources/Public/Javascripts/my.js): failed to open stream

The path is stripping a path segment to the TYPO3_path it should be this instead:

/home/www/p123456789/html/*TYPO3*/typo3conf/ext/myext/Resources/Public/Javascripts/my.js

Somehow, files that are included using the PageRenderer will be delivered relative to the RessourceCompressor like:

“../typo3conf/ext/myext/Resources/Public/Javascripts/my.js”

Line 284 of RessourceCompressor will then strip it away and remove the /typo3/-part of the path in this line:

$filenameAbsolute = GeneralUtility::resolveBackPath($this->rootPath . $filename);

Reviews 2