accent-sass in the browser

A Sass compiler written in Rust, built to WebAssembly. Everything below compiles in this tab: no server, no Node, no network after the page loads. Change a theme value and a whole design system rebuilds.

Module
loading
Engine
accent-sass
Reference
dart-sass 1.104.1

Source

Result

Loading the compiler…

What this is showing

A real design system, compiled here

USWDS is 605 stylesheets and about 800 KiB of Sass. The page holds the whole tree in memory and resolves every @use against it, because the compiler's filesystem is an interface the caller supplies rather than std::fs.

Configuration, not overrides

The theme controls rewrite the @use … with (…) block and recompile from source, so you get the stylesheet the framework would have produced. This is not a layer of CSS pasted on top.

Reads have to be synchronous

The compiler asks for a file and gets bytes back, with nothing to await. An import therefore cannot be fetched while compiling, so the page loads each framework bundle up front. That constraint is the reason the API takes a whole file map.

Fast enough to sit behind a slider

Bulma takes a second or two here and USWDS a handful, against 0.35 s and 1.5 s for the native binary on the same machine. The compile is doing the full job each time, not a cached or partial one, which is why the timing moves with the framework you pick.

The preview frame loads USWDS fonts and icons from jsDelivr, because those are the asset paths USWDS's own settings point at.