News for hackers. Stuff that matters.
Re:My stack is HTML+CSS by dceddia on Thursday January 07, 2021 @12:35PM (#25674257)
Oh boy, YouTube embeds! I went through checking the Lighthouse score on a few of my pages a while back, and the ones that had videos were performing pretty badly.

It turned out that embedded YouTube videos were pulling down something like 1mb of JS, just to show the thumbnail, before the user even clicked Play.

I ended up making a static thumbnail with a hover-over "play" icon that would replace itself with the real embed when it was clicked. Got the Lighthouse score up and saved all those unnecessary downloads. But it was pretty amazing to me that while one arm of Google is pushing for web performance, another is building this YouTube player that auto-downloads a megabyte of JS just to show a thumbnail.

Re:My stack is HTML+CSS by leerob on Thursday January 07, 2021 @12:37PM (#25674276)
Twitter embeds are equally bad. Ended up remaking them to output static HTML + CSS to improve perf (https://leerob.io/tweets).
Re:My stack is HTML+CSS by umaar on Thursday January 07, 2021 @03:43PM (#25677183)
Same, I get ~500 tweets displayed with:

- No JavaScript necessary

- All profile images turned into one massive sprite

- Minimal payload size

Here are what the tweets look like when rendered: https://umaar.com/dev-tips/feedback

Here's the code to achieve that: https://github.com/umaar/better-twitter-embed

Re:My stack is HTML+CSS by toinbis on Thursday January 07, 2021 @04:52PM (#25678083)
Well done, thanks for sharing!
Re:My stack is HTML+CSS by leerob on Thursday January 07, 2021 @04:18PM (#25677635)
Nice job!
Re:My stack is HTML+CSS by recursive on Thursday January 07, 2021 @01:18PM (#25674976)
As a user, I hate twitter embeds. If I select text inside them, they redirect my user agent location. That's never what I want.
Re:My stack is HTML+CSS by winrid on Thursday January 07, 2021 @02:49PM (#25676296)
You can also use lazy loading with iframes.
Re:My stack is HTML+CSS by pabe on Friday January 08, 2021 @12:59AM (#25681968)
This is often a very useful hack indeed! <3