A Vite plugin that integrates PurgeCSS with SvelteKit css assets (currently updated to SvelteKit 1.0.0).
Warning: This package is in experimental state, updates may be critical.
yarn
yarn add -D @erbelion/vite-plugin-sveltekit-purgecss
npm
npm i -D @erbelion/vite-plugin-sveltekit-purgecss
Use plugin in your Vite config (vite.config.ts
).
import purge from '@erbelion/vite-plugin-sveltekit-purgecss'
const config: UserConfig = {
plugins: [
sveltekit(),
purge()
]
}
PurgeCSS will work in .svelte
files if css assets are imported using @import
inside style tag or import
inside script tag.
Default path that will always be processed: src/**/*.{svelte,html}
.
Default safelist item that will always be processed: /(svelte-)[a-zA-Z0-9]{6}/
.
Parameter | Type | Description |
---|---|---|
paths? | string[] |
List of paths to be processed by PurgeCSS. |
safelist? | UserDefinedSafelist |
Check available safelist options in PurgeCSS docs. |