Project

General

Profile

Actions

Bug #91935

closed

Relative pathes in inline CSS not adapted (page.includeCSS.<file>.inline=1)

Added by Sven Tappert over 4 years ago. Updated about 4 years ago.

Status:
Closed
Priority:
Should have
Assignee:
-
Category:
-
Target version:
-
Start date:
2020-08-05
Due date:
% Done:

100%

Estimated time:
TYPO3 Version:
10
PHP Version:
Tags:
includeCSS, CSS, inline, path
Complexity:
Is Regression:
Sprint Focus:

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/...

So there are:
  • 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)
Actions

Also available in: Atom PDF