Skip to content

Load Pico CSS non-render-blocking via preload+swap - #165

Open
alexwolson wants to merge 1 commit into
mainfrom
fix/defer-pico-css
Open

Load Pico CSS non-render-blocking via preload+swap#165
alexwolson wants to merge 1 commit into
mainfrom
fix/defer-pico-css

Conversation

@alexwolson

Copy link
Copy Markdown
Collaborator

Summary

  • Lighthouse flagged pico.pumpkin.min.css (loaded from jsDelivr) as the largest render-blocking request, ~759ms estimated savings.
  • Per team direction, not self-hosting/vendoring the file — instead using the standard rel="preload" + onload swap pattern (with a <noscript> fallback) so the browser fetches it without blocking HTML parsing, then applies it as a stylesheet once it arrives.

Trade-off to be aware of

Pico is this site's primary CSS framework, not a minor addition — custom.css builds on its classes/variables. Making it non-blocking means the page can render briefly unstyled before the swap fires (a real flash-of-unstyled-content, not just a cosmetic nit). On a fast connection this window is very short; on a slow/high-latency connection it will be more visible. Recommend reviewers check this with Chrome DevTools network throttling (e.g. "Slow 4G") before merging, to confirm the trade-off is acceptable.

Fixes #157

Test plan

  • Built and served locally; confirmed via console that the <link>'s rel correctly flips from preload to stylesheet on load
  • No console errors after load
  • Confirmed Pico's theme (button colors, fonts, grid layout) is fully applied post-load
  • Reviewer: check visually under throttled network conditions for FOUC severity
  • Re-run Lighthouse and confirm this request no longer appears in "Render-blocking requests"

🤖 Generated with Claude Code

Lighthouse flagged the jsDelivr-hosted Pico CSS as the largest
render-blocking request (~759ms estimated savings). Rather than
vendoring the file into the repo, use the standard preload+onload
swap pattern (with a <noscript> fallback) so it downloads without
blocking the parser, then applies as a stylesheet once loaded.

Note: since Pico is the site's primary CSS framework (not a minor
addition), this trades render-blocking for a brief flash of
unstyled content while the swap completes - negligible on a fast
connection, more visible on a slow one. Verified locally: no console
errors, the link's rel correctly flips to "stylesheet", and Pico's
theme (colors, fonts, grid) is fully applied post-load.

Fixes #157

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@github-actions

Copy link
Copy Markdown
Contributor

Pa11y Accessibility Report

All pages passed — 0 warning(s) (WCAG2AA)


Homepage

✅ No issues found.


Event

✅ No issues found.


Project

✅ No issues found.


Person

✅ No issues found.


Organization

✅ No issues found.


Venue

✅ No issues found.


Resource

✅ No issues found.


Tag

✅ No issues found.


Category

✅ No issues found.

@alexwolson
alexwolson requested a review from Khasir July 22, 2026 13:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Self-host or defer Pico CSS to remove render-blocking jsDelivr request

1 participant