Repository navigation
Lighter pages: WebP images, sized images, WOFF2 font - #8
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Requested by Mehran · project thread
Before: the heaviest pages downloaded 4–7 MB on a phone. Most images had no
width/height, so the layout jumped while they loaded. Every page also downloaded a 279 KB TTF font.After: the same pages look the same (verified below) but download a lot less. Layout no longer jumps as images arrive.
Bytes loaded after scrolling the whole page, 390 px phone:
blog.html)The homepage barely moves because most of its weight is the Moondust video and the grainy slideshow photos (see follow-ups).
What changed
Images/og/) stay JPEG for link previews. Three files that didn't shrink by 10% were left alone.width/heighton 237<img>tags, set to each file's real pixel size. CSS still controls the displayed size; the attributes just let the browser reserve the space.font-display: swap, so text shows immediately in a fallback font while the font loads.How it was tested
mainand from this branch in headless Chromium at 390 px and 1440 px, with reduced motion. Every image's position and size, and every page's height, match exactly (0 moved images).Risks and follow-ups
font-display: swapmeans that on a slow connection the first paint uses Arial for a moment before PT Sans arrives.webfonts/PTSans_Regular/stylesheet.cssstill carries old page rules (body, html { display: flex },main { display: flex }, …) thatsite.cssimports on every page. That's the source of the "main lays out as a row" bug. Removing them needs a visual pass on every page.Suggestions
@font-faceintosite.cssand drop the legacy stylesheet import (backlog 13).