, 8 tweets, 5 min read Read on Twitter
🔥 Here’s a performance thread (haha get it, thread?) in case it’s useful to anyone:

1️⃣ If you don’t know Intersection Observer for detecting/loading images/script/whatever, here’s a basic-example example:
codepen.io/sdras/pen/cecb…

Docs: developer.mozilla.org/en-US/docs/Web…
2️⃣ Image optimization for hero photos- this trick I learned from @smashingmag- make the image 2x bigger & make the quality very low

But then I take it another step and use @shshaw's SVG converter, brought >1MB imgs down to 30kb without loss of quality!

s.codepen.io/shshaw/debug/L…
3️⃣ Please use gzip if you aren't already! HUGE gains. Cloudflare && Netlify will give it to you out of the box

Netlify will allow you to configure your headers with a small _headers file for efficient caching: netlify.com/docs/headers-a…

Playground here: play.netlify.com/headers
4️⃣ Fonts can have a HUGE impact on perf. I recently learned about `font-display: swap;` from @notwaldorf

font-display.glitch.me

And check out this huge repo of web font loading recipes by @zachleat! 😱
github.com/zachleat/web-f…
5️⃣ Inlining critical CSS and deferring what you can is also super helpful if you do have any utilities- @timkadlec showed me Google Chrome Labs Critters for projects built with Webpack and I've liked it so far :)

github.com/GoogleChromeLa…
6️⃣ If you use @nuxt_js, you can lazy-load in components by updating the import from:

import SomeComponent from "./SomeComponent.vue";

to:

const SomeComponent = () => import("./SomeComponent.vue");

Hat tip to @Atinux for this one!
7️⃣ Finally, link rel="preload" is a really quick win for letting browsers know what resources you'll need the most

Docs: developer.mozilla.org/en-US/docs/Web…

Great writeup by @addyosmani here on some of the wins! 🏆: medium.com/reloading/prel…
Ok, I'm done, time for a cocktail 🍸 Cheers!
Missing some Tweet in this thread?
You can try to force a refresh.

Like this thread? Get email updates or save it to PDF!

Subscribe to Sarah Drasner
Profile picture

Get real-time email alerts when new unrolls are available from this author!

This content may be removed anytime!

Twitter may remove this content at anytime, convert it as a PDF, save and print for later use!

Try unrolling a thread yourself!

how to unroll video

1) Follow Thread Reader App on Twitter so you can easily mention us!

2) Go to a Twitter thread (series of Tweets by the same owner) and mention us with a keyword "unroll" @threadreaderapp unroll

You can practice here first or read more on our help page!

Follow Us on Twitter!

Did Thread Reader help you today?

Support us! We are indie developers!


This site is made by just three indie developers on a laptop doing marketing, support and development! Read more about the story.

Become a Premium Member ($3.00/month or $30.00/year) and get exclusive features!

Become Premium

Too expensive? Make a small donation by buying us coffee ($5) or help with server cost ($10)

Donate via Paypal Become our Patreon

Thank you for your support!