Rollup plugin to remove unused CSS using PurgeCSS. Current stable version 8.0.0. Part of the PurgeCSS monorepo, releases follow PurgeCSS core releases. Key differentiator: tree-shaking CSS in Rollup bundles based on content analysis, supporting safelisting, extractors, and CSS variables. Compatible with Rollup 2+, ESM-first with TypeScript types. Regular releases with breaking changes across major versions. Alternative to cssnano and uncss for unused CSS removal.
npm install rollup-plugin-purgecssNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Basic Rollup configuration using purgecss plugin with safelist and CSS variable removal.
import purgeCSSPlugin from '@fullhuman/postcss-purgecss';
Upgrade to PostCSS 8 or use @fullhuman/postcss-purgecss@3 if stuck.
Use safelist option with standard, deep, greedy arrays as documented.
Use Rollup's --watch flag or configure watch options.
Update to v7.0.2 or later.
npm install rollup-plugin-purgecss --save-dev
Use import purgecss from 'rollup-plugin-purgecss'; (ESM) or const { default: purgecss } = require('rollup-plugin-purgecss');Replace whitelist with safelist; see migration guide to v3.
Use import purgeCSSPlugin from '@fullhuman/postcss-purgecss';