Remove all preprocessors except for optimizeImports
optimizeImports: drop support for carbon-icons-svelte version 10, carbon-pictograms-svelte version 10
Rewrite optimizeCss plugin from scratch; it's now offered as a Vite/Rollup/Webpack plugin. carbon-components-svelte@0.85.0 or greater is required
optimizeImports
Completely re-written imports optimizer
Only supports latest major versions of icons/pictgrams
Notes: for best DX, also instruct Vite to optimizeDeps.ignore
optimizeCss
Vite/Rollup plugin, enforced in build phase
Steps:
The potential for false positives is too high (relying on any and all selectors). Instead, focus on class names as this is much more defensive (e.g., .bx--). The goal is to still remove the bulk of unused .bx-- selectors without needing to stress about false positives.
Pre-index the used class names per Carbon component.
Gather the resolved component names in the plugin.transform hook.
In the generateBundle hook, read in all generated .css files.
Traverse the CSS AST and remove all .bx-- selectors that are not included in the map.
Closes #50, closes #44, closes #46, closes #53, closes #52, closes #48, closes #47, closes #46, closes #40, closes #26, closes #24, closes #19, closes #18, closes #17, closes #28
Breaking Changes
optimizeImports
optimizeImports
: drop support forcarbon-icons-svelte
version 10,carbon-pictograms-svelte
version 10optimizeCss
plugin from scratch; it's now offered as a Vite/Rollup/Webpack plugin.carbon-components-svelte@0.85.0
or greater is requiredoptimizeImports
Notes: for best DX, also instruct
Vite
tooptimizeDeps.ignore
optimizeCss
Steps:
The potential for false positives is too high (relying on any and all selectors). Instead, focus on class names as this is much more defensive (e.g.,
.bx--
). The goal is to still remove the bulk of unused.bx--
selectors without needing to stress about false positives.plugin.transform
hook.generateBundle
hook, read in all generated.css
files..bx--
selectors that are not included in the map.