Skip to content
This repository has been archived by the owner on Jun 2, 2022. It is now read-only.

chore: Remove inline styles #408

Merged
merged 3 commits into from
Mar 22, 2022
Merged

chore: Remove inline styles #408

merged 3 commits into from
Mar 22, 2022

Conversation

tlgimenes
Copy link
Contributor

@tlgimenes tlgimenes commented Mar 22, 2022

What's the purpose of this pull request?

This PR replaces inline <style/> tags by tags.

How does it work?

Inlining styles is good technique for decreasing FCP. It, however, increases TBT, since the browser processes both CSS and HTML in one go, instead of processing them on two different tasks.
This PR moves inline styles to an isolated stylesheet and removes CSS code splitting for the sake of simplicity.

FCP shouldn't be penalized that much since this CSS is hashed and has an immutable cache header, which is heavily cached by the CDN.

Moving inline styles to a custom sheet is not natively supported by gatsby, so a hack had to be made. This hack is described in here: gatsbyjs/gatsby#1526

How to test it?

Nothing should have changed visually. However, PSI score should be bigger than master

Checklist

  • CHANGELOG entry added

@netlify
Copy link

netlify bot commented Mar 22, 2022

✅ Deploy Preview for basestore ready!

🔨 Explore the source changes: ac7cb08

🔍 Inspect the deploy log: https://app.netlify.com/sites/basestore/deploys/6239b6183ee74c000880a581

😎 Browse the preview: https://deploy-preview-408--basestore.netlify.app

@vtex-sites
Copy link

vtex-sites bot commented Mar 22, 2022

Preview is ready

This pull request generated a Preview

👀   Preview: https://preview-408--base.preview.vtex.app
🔬   Go deeper by inspecting the Build Logs
📝   based on commit 426907e

@tlgimenes tlgimenes added the performance Improvements to performance label Mar 22, 2022
@tlgimenes tlgimenes requested a review from a team March 22, 2022 11:23
@igorbrasileiro
Copy link
Contributor

Did it increased the CLS? Or still the same?

@gatsby-cloud
Copy link

gatsby-cloud bot commented Mar 22, 2022

Gatsby Cloud Build Report

basestore

🎉 Your build was successful! See the Deploy preview here.

Build Details

View the build logs here.

🕐 Build time: 7m

Performance

Lighthouse report

Metric Score
Performance 🔶 86
Accessibility 💚 100
Best Practices 💚 100
SEO 💚 93

🔗 View full report

@tlgimenes tlgimenes merged commit 426907e into master Mar 22, 2022
@tlgimenes tlgimenes deleted the chore/css-performance branch March 22, 2022 13:16
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
performance Improvements to performance
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants