Bug #91935
closedRelative pathes in inline CSS not adapted (page.includeCSS.<file>.inline=1)
100%
Description
Usually relative pathes to fonts and images in CSS files are being adapted by Typo3 when needed. This is usually necessary when compression and concatenation is applied and final CSS files are generated in a subdirectory of typo3temp
.
Unfortunately, when using the TypoScript Setup option page.includeCSS.<fileID>.inline = 1
the relative pathes are NOT replaced.
Let's assume an extension user_package
with a CSS file and a font file in subdirectories of typo3conf/ext/user_package/Resources/Public/Layout/...
typo3conf/ext/user_package/Resources/Public/Layout/css/inline-styles.css
typo3conf/ext/user_package/Resources/Public/Layout/fonts/localFontFile.eot
The font file will be referenced within inline-styles.css like this:
src: url(../fonts/localFontFile.eot)
When using regular Typo3 concatenation and compression, the final CSS file is located in /typo3temp/assets/compressed/
and the font path will be translated to
src: url(../../../typo3conf/ext/user_package/Resources/Public/Layout/fonts/localFontFile.eot)
This path translation is performed in \TYPO3\CMS\Core\Resource\ResourceCompressor::findAndReplaceUrlPathsByRegex()
and works fine.
When using the TypoScript Setup option page.includeCSS.<fileID>.inline = 1
the relative pathes should be replaced as well, to avoid invalid references. Final path translation should be absolute to document root, e. g.:
src: url(/typo3conf/ext/user_package/Resources/Public/Layout/fonts/localFontFile.eot)