Load Pico CSS non-render-blocking via preload+swap - #165
Open
alexwolson wants to merge 1 commit into
Open
Conversation
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>
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. |
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.
Summary
pico.pumpkin.min.css(loaded from jsDelivr) as the largest render-blocking request, ~759ms estimated savings.rel="preload"+onloadswap 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.cssbuilds 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
<link>'srelcorrectly flips frompreloadtostylesheeton load🤖 Generated with Claude Code