vite-plugin-sveltekit-purgecss Svelte Themes

Vite Plugin Sveltekit Purgecss

A Vite plugin that integrates PurgeCSS with SvelteKit css assets.

vite-plugin-sveltekit-purgecss

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.

Installation

yarn

yarn add -D @erbelion/vite-plugin-sveltekit-purgecss

npm

npm i -D @erbelion/vite-plugin-sveltekit-purgecss

Usage

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}/.

Additional Options

Parameter Type Description
paths? string[] List of paths to be processed by PurgeCSS.
safelist? UserDefinedSafelist Check available safelist options in PurgeCSS docs.

See also

vite-plugin-laravel-purgecss

Top categories

Loading Svelte Themes