Closed MediKathi closed 2 years ago
Have you considered to migrate your asset includes to the new AssetCollector?
Introduction: https://docs.typo3.org/c/typo3/cms-core/master/en-us/Changelog/10.3/Feature-90522-IntroduceAssetCollector.html
Viewhelpder docs: https://docs.typo3.org/other/typo3/view-helper-reference/10.4/en-us/typo3/fluid/latest/Asset/Css.html
The Asset-Collector seams to be a nice Feature, but accutally we (in the company I work for) are using a slight modified version of the vhs Asset-Service since Typo3 v7. We Keep the Code of the Fork upn to date. We Added a possibility to Compile SASS directly within the Assest-Service with one call to the Compiler, after the files are combined. Because the Asset-Service is called via the Hook, we are easily and update-safe able to replace the Original with our internal fork.
For posterity: this only happens if config.no_cache = 1
or other implementations disable page cache completely. Solved now by switching to request middlewares on TYPO3 versions that support this. @MediKathi beware, I had to change an (internal) method signature AssetService::buildAll (and others internally) so if you plan on keeping your AssetService override you might need to adjust that.
@NamelessCoder, Has this been tested in TYPO3 9.5 and 10.4? When page is not cached, the assets are loaded, but after caching, they are gone. Proble started with in 6.1.0
EDIT: I tested with TYPO3 11.5, and it's not working there either.
@mkarulin It was tested on all four supported TYPO3 versions, but it's possible (likely) that some specific context state was affecting my results while testing. For example, I was always logged in to the BE.
Can you open a new issue for this, then I will look into it?
Some of the hooks are gone in Typo3 v11 now.
For example: $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['tslib/class.tslib_fe.php']['contentPostProc-output'] which ist used by the assetservice
Therefore the Asset Viewhelpers are not longer working.
Edit: I was able to get this working in a Kinda lazy way, I reimplemented the old hook:
I had to create a file
typo3conf/ext/myExt/Configuration/RequestMiddlewares.php
also setting up some stuff in the
typo3conf/ext/myExt/Configuration/Services.yaml
And Filnaly remimplemented the Hook
typo3conf/ext/myExt/Classes/Middleware/Assets.php
:The new hook can then be used in the
ext_localconf.php
: