Closed wazum closed 2 years ago
See vendor/matthiasmullie/minify/src/Minify.php:89
for details on how the key is generated and then used in the execute
method vendor/matthiasmullie/minify/src/CSS.php:301
as $source
variable to determine the correct path.
Hi, thanks for you issue. I've recently used EXT:min in a project including fonts and there I had no issues.
When your CSS is located in Resources/Public/Css/
and your font in Resources/Public/fonts
you can simply address the font in CSS like this:
src: url("../fonts/my-font-regular.eot");
Also I'm suspisious that your approach really works, because when you create the $pathSite . $targetFilename
file on your own, minifier will not minify it anymore (see condition in line 129) https://github.com/a-r-m-i-n/min/blob/master/Classes/Minifier.php#L129). Only the additional CSS compression will be applied to your CSS, then.
@a-r-m-i-n thanks, the same file name is a mistake, point taken, the rest is still valid, but maybe you have an idea how to solve it:
../fonts/…
path in my source CSS filespage.config {
compressCss = 1
concatenateCss = 1
\TYPO3\CMS\Core\Resource\ResourceCompressor::cssFixRelativeUrlPaths
which changes the paths to ../../../something/…
Hey. I'm currently working on #2 and I think I know where the problem is. When you concatenate css files, TYPO3 is fixing the relative links, because the location of the actual called file moved to typo3temp/assets/compressed
When min is doing the same, the file paths are not getting adjusted. Need to investigate further, but it looks promising. Now, I'm on your page ;)
@wazum I think I got it :) Could you please test with the latest master? Thank you
@a-r-m-i-n thanks for version 2.1.0. The relative css paths of fonts in a compressed file are working now, but not if you already use the composer-installer v4 package with TYPO3 11, which has a different folder structure of public assets. See also: https://b13.com/core-insights/typo3-and-composer-weve-come-a-long-way
Thanks for your response. I think this worth a dedicated issue.
This issue did already exist in the forge and bitbucket tracker, but was never fixed. Now I changed to the recent version and had to adapt my patch.
Example: in the CSS file generated by TYPO3 there's path like
../../../typo3conf/ext/my_ext/Resources/Public/fonts/myfont.xxx
and the problem is that your extension passes the content of the file to the$minifier->add
method, which results in appending another../../..
in front of the already correct relative paths (because the source is missing). The solution is to write the output ofcompressCss
to a file and pass the file name to$minifier->add
, then the source path is correctly determined by minifier and not changed.Here's my local patch: