github carbon-design-system/carbon-preprocess-svelte v0.12.4

36 minutes ago

Features

  • optimizeCarbonBun: a Bun.build plugin that rewrites Carbon components for the props your app passes, like optimizeComponents, and prunes the build's CSS from the same analysis. Hand load(path)?.code to your Svelte plugin's onLoad, then prune after the build:

    const carbon = optimizeCarbonBun();
    const result = await Bun.build({ metafile: true, plugins: [carbon, svelte] });
    await carbon.pruneBuild(result);

    On the same input the CSS is byte-identical to the Vite plugins'. Bun lowers CSS for older browsers, which inflates Carbon's stylesheet, so for the smallest output pass Carbon's raw all.css to pruneCss({ carbon }). See the README for the full recipe.

  • createCarbonOptimizer: the bundler-neutral core optimizeCarbonBun builds on, for build tools without a plugin here.

Fixes

  • optimizeCarbonCss warns when it skips the default propAware because content is missing, instead of pruning by imported components alone without saying so.

Don't miss a new carbon-preprocess-svelte release

NewReleases is sending notifications on new releases.