Preloading CSS inside the Body makes no sense and will just cause CLS
-
Hi,
Inside the plugin codelib/creations/class-creations-views.php
online no265
you guys have a function namedadd_async_styles()
which basically adds a<link rel="preload" ...>
for the mediavine create CSS.But adding
rel=preload
inside thebody
content will have no effect as therel=preload
is supposed to be used inside the<head>
in fact as early as possible so that the browser can preload and parse that styles before going inside the body content.But here as the preload is happening way inside the
<body>
it has absolutely no purpose and the browser cannot preload it as intended.Currently the
add_async_styles()
is being called using thestyle_loader_tag
filter, but I would highly recommend instead using thewp_head
action to ensure that the preload gets added within the<head>
as early as possible so that the browser can preload it.On top of that you guys have added the normal stylesheet load i.e.
<link rel="stylesheet" id="mv-create-card/css-css" href="...">
inside a<noscript>
which makes absolutely no sense. The link preload is not a javascript dependent task. So, no script makes no sense.So, if you wish to preload the CSS using
rel=preload
just do that, no need to add thenoscript
part.On the other hand if you want to load the CSS in the normal way, do that and don’t use the preload. But whatever you do needs to be done in the
<head>
and not inside<body>
.Hope someone from the development team will see this message and work on it.
Thanks.
- The topic ‘Preloading CSS inside the Body makes no sense and will just cause CLS’ is closed to new replies.