Google Page Speed told us, that we have rendering blocking CSS.
Now we try to solve this with CSS Critical Path activated.
We have created a Critical.css file
We have integated the same in our Theme.
All works fine, we try which styles are important and which CSS can load later.
BUT now the source code coming from CSS Critical Path in general adds a weird dot, (like a ".") to the code between media="all" and onload...:
link rel="preload" as="style" media="all" . onload="this.onload=null;this.rel='stylesheet'"href="http:
See here as well.
When running validator.w3.org it says
Error: Attribute . not allowed on element link at this point.
and also
Warning: Attribute . is not serializable as XML 1.0.
So this funny dot (.) is there.
Does anyone of you experts have a clue why this is there and how we could get rid of it?
Any help is so appreciated.
Warm regards
-
How have you added this CSS file?Ben Crook– Ben Crook2020年01月22日 17:17:48 +00:00Commented Jan 22, 2020 at 17:17
-
Hi Ben, we have added the same as per "The ‘critical’ CSS file should be located in app/design/frontend/<your_vendor_name>/<your_theme_name>/web/css/critical.css " like mentioned here: devdocs.magento.com/guides/v2.3/frontend-dev-guide/css-topics/… - using this Penthouse generator jonassebastianohlsson.com/criticalpathcssgenerator Best regardsBen– Ben2020年01月23日 17:23:12 +00:00Commented Jan 23, 2020 at 17:23
-
Ah I completely forgot M2 supports critical CSS out the box. I haven't seen this problem before but I will be setting critical CSS up on a project soon so if I run into the problem and find a solution I'll provide the answer here.Ben Crook– Ben Crook2020年01月24日 09:44:09 +00:00Commented Jan 24, 2020 at 9:44
-
Hi guys did you already resolved the issue?Eubie Aluad– Eubie Aluad2020年09月22日 15:22:48 +00:00Commented Sep 22, 2020 at 15:22
1 Answer 1
It is a bug in Magento, fixed in the new version 2.4 see here https://github.com/magento/magento2/pull/26764/commits/f9697f509ae09f5c9e0f0d7b1a2de7ed9a53fc16