gjin@prishtina/writing

This site scores 100 on Lighthouse while playing an intro

The homepage plays a deploy animation on first visit and still scores 100 in all four Lighthouse categories. The first run scored 99. Here's what moved it, with the real numbers.

The first time you open this site, it pretends to deploy itself: git push, four stages filling in, then a wipe. The numbers in that log are real, measured from your own page load. And the homepage scores 100 in Performance, Accessibility, Best Practices and SEO, on mobile and desktop, with that intro playing.

It didn’t start at 100. Here’s the path, with the numbers from the runs.

The rule: test the page people actually get

Lighthouse always runs as a first visit, so it always sees the intro. It would have been easy to make the test skip it. I didn’t: a score that doesn’t measure what visitors get is decoration. If the intro costs points, the intro gets lighter.

First run: 99

Mobile Performance came back at 99, three runs in a row:

No JavaScript cost, no layout shift. The page was simply waiting on fonts. Lighthouse’s simulated slow mobile connection was downloading 88 kB of Archivo and 40 kB of JetBrains Mono before the main paragraph could paint in its real typeface.

The fix: fonts cut to what the site uses

Both fonts are variable: one file holds every weight, and Archivo holds every width too. The site uses a narrow slice of that, so the fonts are now subset at build time with HarfBuzz:

Archivo went from 88 kB to 47 kB, JetBrains Mono from 40 kB to 26 kB. Largest Contentful Paint dropped to 1.5 s, and mobile Performance went to 100 on every run.

The trade-off is a test: if a page ever uses a character outside the subset, the build fails and names it. Better a failing check than a letter quietly falling back to another font.

Things that would have cost points later

An overlay that can’t get stuck. The intro is shown by a tiny script in the head and removed by the page’s main script. If that script is blocked, the overlay would stay forever. So CSS alone hides it after 2.5 seconds, script or no script.

Fonts can’t hold the page hostage. The intro waits at most 300 ms for fonts before it starts. With fonts stalled on purpose for 5 seconds, it still finishes in about 2 seconds.

Layout shift from JavaScript positioning. The boxes wired to my name were first placed by a script, so they jumped on load: a layout shift of about 0.016 on desktop. Now CSS places them from the name’s size (font size times line height), and the script only draws the wires. Shift is back to 0, and the boxes are in place even with JavaScript off.

What it says about the stack

Nothing here needed a framework trick. A static Astro build, two small scripts, fonts sized to the job, and a test for every promise. The intro is about 1 kB of JavaScript; the whole wired name is 3 kB.

The checks fail any page below 100.

All notes