Shopify Builds>Primitives>Deferred CSS loading

Deferred CSS loading

Definition

Deferred CSS loading takes a stylesheet off the critical path. The link is requested with a media type that doesn't match, then switched to all once it has loaded, so the file downloads in parallel and applies after first paint. A noscript twin keeps the styles working where scripts don't run. Shopify's performance guidance treats the pattern as standard.

Documented at shopify.dev, theme performance best practices.

How We've Used It

The decision this primitive forces is which sheets are render-critical, and the honest answer is usually two. Base and layout styles get preloaded; component sheets for a carousel, a rich-text page or a recommendation rail go through the media swap with a fallback beside each one. We do the same on sections that reuse a component from elsewhere in the theme but ship on a page template, where four inherited stylesheets would otherwise block a page that may never scroll far enough to need them. The failure mode worth naming is deferring a sheet that paints above the fold: the element renders unstyled and then reflows when the sheet applies.

Builds Using It

One further gated build uses it; its page follows.

Related Entities

Builds