https://github.com/Jax-p/vite-plugin-html-purgecss
It is a fork ofvite-plugin-html-purgecss-v3
This Vite plugin purges CSS based on HTML output using PurgeCSS.
'bg-' + true ? 'red' : 'blue'
) because PurgeCSS runs over already generated HTML (post).
Install
Yarn
yarn add vite-plugin-html-purgecss-v3 -D
or npm
npm i vite-plugin-html-purgecss-v3 --save-dev
Usage
Configuration
Use plugin in your Vite config (vite.config.ts
)
import htmlPurge from 'vite-plugin-html-purgecss'
export default {
plugins: [
htmlPurge(),
]
}
Options
Parameter | Type | Description |
---|---|---|
safeList | UserDefinedSafelist |
Check available safelist options in PurgeCSS docs. |