coach icon indicating copy to clipboard operation
coach copied to clipboard

Coach counts Link Preload stylesheet as render blocking

Open mendaomn opened this issue 6 years ago • 5 comments

According to my tests, the coach counts as render blocking a stylesheet loaded with Link Preload

To reproduce:

docker run --shm-size=1g --rm -v "$(pwd)":/sitespeed.io sitespeedio/sitespeed.io:7.4.0 https://www.westwingsolutions.com/ -b chrome -n1

On that page, the resource /static/styles/home.later.css is loaded as follows:

<link rel="preload" as="style" href="/static/styles/home.later.css" onload="this.rel='stylesheet'">

To my knowledge, this shouldn't count as a render blocking CSS resource

I think one could either call a different function here: fastRender.js:7

Or maybe add a .filter here: fastRender.js:44

Hope this helps!

mendaomn avatar Sep 21 '18 09:09 mendaomn

Hi @mendaomn thanks for the feedback, yeah we should look into that, any change you can make a PR?

Best Peter

soulgalore avatar Sep 22 '18 13:09 soulgalore

Taking a deeper look at a possibile fix, it does seem you already are checking only styles with rel="stylesheet" which should by definition exclude the ones with rel="preload"

However, in my site there's a <noscript><style rel="stylesheet" ...></style></noscript> fallback and that may be the one that gets found by util.getCSSFiles()

At this point I'm not sure whether sitespeed wants and needs to take into account stuff inside of the noscripts, and therefore whether and how to fix it

Best Alessandro

mendaomn avatar Oct 05 '18 09:10 mendaomn

Hi @mendaomn I'm planning to rework the recommendations for the Coach late October or late November, let keep this issue open until then. I will concentrate the time now first to release the new version of sitespeed.io etc.

Best Peter

soulgalore avatar Oct 05 '18 12:10 soulgalore

Hey @soulgalore

Congrats on releasing Coach 3.0!! It looks like it features a lot of cool stuff!

I was wondering whether this issue is still relevant, or is it now to be closed? :)

Best Alessandro

mendaomn avatar Nov 21 '18 07:11 mendaomn

Hi @mendaomn no I haven't looked at it, sorry!

Best Peter

soulgalore avatar Nov 21 '18 07:11 soulgalore