Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sort preload assets so that styles are first #576

Merged
merged 1 commit into from
Jun 5, 2020

Conversation

tomkelsey
Copy link
Contributor

Summary

When getting the preload assets, sort them so that the style assets are first.

I saw a PR over in next.js (vercel/next.js#9486). Apparently preloading the JS first can slow down some browsers and delay the styles loading and therefore negatively impact performance/lighthouse scores.

I tested the approach on our own site and it led to quite a dramatic improvement in lighthouse score.

Test plan

I tried to run the tests locally but it errored with something I didn't understand. I'm afraid I don't have the time at the moment to wrap my head around it but figured this PR may be useful to some people so would submit it anyway.

@theKashey
Copy link
Collaborator

Good idea. We were so concerned making js faster to load that made CSS load slower. And it blocks page rendering, so has to be to top priority.

@theKashey
Copy link
Collaborator

However no merges on Friday.

@theKashey theKashey merged commit c618c41 into gregberge:master Jun 5, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants