JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 3850
  • Score
    100M100P100Q126007F
  • License MIT

PurgeCSS plugin for Vite

Package Exports

  • vite-plugin-purgecss
  • vite-plugin-purgecss/dist/index.js

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (vite-plugin-purgecss) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

Fork of vite-plugin-html-purgecss

vite-plugin-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

npm

npm i vite-plugin-purgecss --save-dev

Usage

Configuration

Use plugin in your Vite config (vite.config.ts)

import htmlPurge from 'vite-plugin-purgecss'

export default {
    plugins: [
        htmlPurge(),
    ]
}

Options

Optionally supply a UserDefinedOptions as you would with PurgeCSS.