Features
-
optimizeCarbonBun: aBun.buildplugin that rewrites Carbon components for the props your app passes, likeoptimizeComponents, and prunes the build's CSS from the same analysis. Handload(path)?.codeto your Svelte plugin'sonLoad, 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.csstopruneCss({ carbon }). See the README for the full recipe. -
createCarbonOptimizer: the bundler-neutral coreoptimizeCarbonBunbuilds on, for build tools without a plugin here.
Fixes
optimizeCarbonCsswarns when it skips the defaultpropAwarebecausecontentis missing, instead of pruning by imported components alone without saying so.