Menu

Our Fallback Stylesheet Reaches for 25 Design Tokens and Declares None of Them
📰

Our Fallback Stylesheet Reaches for 25 Design Tokens and Declares None of Them

DEV Community: css·OnePassApps·7 days ago
#YqFPTtBp
#devtocss#devto#dev#bundle#fallback
Reading 0:00
15s threshold

I work on OnePassApps, the team behind app.onepassapps.com, so this is our own build, and every number below was measured on it today over plain HTTPS from outside the browser - no session, no cookies, no JavaScript, one fetch per URL.

We ship a small static stylesheet for the moment the app does not come up. It is a separate file beside the app bundle, and it is linked first on every page. What it does with variables is the interesting part.

The file

The static fallback stylesheet answers HTTP 200 with 3054 bytes. The app bundle's stylesheet, /assets/index-B_evf03w.css, answers HTTP 200 with 242648 bytes and declares 403 custom properties, referenced 346 times with var().

What the small file does with variables

It uses 25 distinct custom properties in its var() calls.

It declares 0 of them itself.

Not one of its var() calls carries a default value: 0 calls have a fallback value after the comma.

The tokens it reaches for are the ordinary design ones - --brand, --brand-edge, --brand-wash, --canvas,…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.