Skip to content

Jax-p/vite-plugin-html-purgecss

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

vite-plugin-html-purgecss

This Vite plugin purges CSS based on HTML output using PurgeCSS.

✔️ Works with Multi Page App
✔️ Content/pattern setup is not needed - plugin purges styles over the whole HTML code which is being resolved by Vite
✔ Classes can be dynamically created ('bg-' + true ? 'red' : 'blue') because PurgeCSS runs over already generated HTML (post).

Install

Yarn

yarn add vite-plugin-html-purgecss -D

or npm

npm i vite-plugin-html-purgecss --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.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published