An esbuild plugin that integrates PurgeCSS to remove unused CSS from your bundled output. Currently at version 0.0.6 (stable, no recent updates). It allows configuration via PurgeCSS options and content paths. Key differentiator: lightweight, zero-config setup for esbuild users wanting to eliminate dead CSS during bundling. Alternatives like purgecss-webpack-plugin are more complex and Webpack-specific. Supports TypeScript types. Release cadence: low—last update over a year ago.
npm install esbuild-plugin-purgecssNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Basic usage: removes unused CSS by scanning HTML files for class references. Configurable content paths and safelist.
Ensure your esbuild build outputs CSS to a file; plugin will process it automatically.
Consider switching to a more maintained alternative like purgecss-webpack-plugin if using webpack or check if the repo is active.
Disable esbuild's CSS minification or chain plugins carefully.
Validate options against PurgeCSS documentation, e.g., use 'content' not 'paths'.
Install purgecss: npm install purgecss
Use default import: import purgecssPlugin from 'esbuild-plugin-purgecss'
Ensure content globs correctly resolve to files that reference CSS classes.