In TYPO3 v13 with typo3_encore v6.0.1 it was possible to add CSS and JavaScript files using TypoScript:
page {
includeCSS {
website = typo3_encore:website
website.media = all
}
includeJS.website = typo3_encore:website
includeJS.website.defer = 1
}
This does not work with TYPO3 v14 and typo3_encore v7.0.0. The hook was removed when updating to v14:
Pull Request 262
PageRendererHooks.php
We are not using Fluid Templates, so this was the only way to add the CSS/JavaScript files.
I had a look at the code and it's hard to support the old syntax, because TYPO3s RequestHandler tries to resolve the URLs using the new SystemResourceFactory introduced in v14:
https://docs.typo3.org/c/typo3/cms-core/main/en-us/Changelog/14.0/Feature-107537-SystemResourceAPIForSystemFileAccessAndPublicUriGeneration.html
When an invalid URL is returned, the CSS file is ignored:
https://github.com/TYPO3/typo3/blob/v14.3.3/typo3/sysext/frontend/Classes/Http/RequestHandler.php#L437-L449
But it might be possible to adjust the TypoScript. When using the PKG prefix, the CSS file will be "resolved" as PKG:ssch/typo3-encore:4wdmedia. Then the PageRendererHooks class could check those files again.
page {
includeCSS {
website = PKG:typo3_encore:website
website.media = all
}
}
I will try to prepare a pull request.
In TYPO3 v13 with typo3_encore v6.0.1 it was possible to add CSS and JavaScript files using TypoScript:
This does not work with TYPO3 v14 and typo3_encore v7.0.0. The hook was removed when updating to v14:
Pull Request 262
PageRendererHooks.php
We are not using Fluid Templates, so this was the only way to add the CSS/JavaScript files.
I had a look at the code and it's hard to support the old syntax, because TYPO3s RequestHandler tries to resolve the URLs using the new
SystemResourceFactoryintroduced in v14:https://docs.typo3.org/c/typo3/cms-core/main/en-us/Changelog/14.0/Feature-107537-SystemResourceAPIForSystemFileAccessAndPublicUriGeneration.html
When an invalid URL is returned, the CSS file is ignored:
https://github.com/TYPO3/typo3/blob/v14.3.3/typo3/sysext/frontend/Classes/Http/RequestHandler.php#L437-L449
But it might be possible to adjust the TypoScript. When using the PKG prefix, the CSS file will be "resolved" as
PKG:ssch/typo3-encore:4wdmedia. Then the PageRendererHooks class could check those files again.I will try to prepare a pull request.