Closed nogueiraludovic closed 1 month ago
The only solution I know for this, is to use an absolute path in CSS file, to /_assets/abcdef01234...
Of course this not ideal... Let me think about a better solution.
Not ideal, yeah, but I tought the folder name was randomly generated. But I saw that it was the same on all environment, so it could work.
Another idea my colleague had was to write EXT:extension/Resources/Public/font.woff2 in the CSS and to parse EXT: and replace it with PathUtility::getPublicResourceWebPath. The problem here is that we don't necessarily want the compression in dev environment.
Kinda hard issue, let me know if you come with an idea.
Another solution could be, to outsource the custom fonts to a separate css file and exclude this file from concatenation and compression.
And the hash in _assets folder is based on the "/vendor/blubb/blah/" path.
As long as you do not rename the package or vendor name or the vendor folder itself, the MD5 hash remains the same in all environments.
Ok, so it strengthened my hate for this change in typo3 12.
Anyway I'll go with the link to the _assets folder. I let you close this issue if you don't see any other workaround. Maybe it can be a good idea to add something in the doc.
When fonts are preloaded in HTML, they are stored in /_assets/XYZ/font.woff2. But when compressing CSS it is stored inside /typo3temp/assets/compressed. Now with a relative path inside the CSS we would like to hit the folder "/_assets/XYZ/font.woff2", but instead we are given this kind of URL: https://XYZ.ddev.site/vendor/typo3/extension/Resources/Public/Css/fonts/TheMix/font.woff2.
Is their a way to call the font inside _assets directory?