css-minimizer-webpack-plugin

A Webpack plugin that minifies CSS build output via cssnano by default, with swappable csso, clean-css, esbuild, and Lightning CSS backends.

Tool
npm
v8.0.0
325stars
MIT License

Repository Health

Pre-computed score based on development activity, maintenance, community, maturity, and trend momentum.How we score it →
47/100Fair
Development Activity12
Maintenance32
Community64
Maturity60
Momentum20

Technical Analysis

AI-assessed by reading the actual repository — architecture, code quality, innovation, and documentation.How we score it →
74/100Good
Architecture78
Code Quality85
Innovation78
Learning Curve55

css-minimizer-webpack-plugin is Webpack’s dedicated CSS asset minifier, wrapping cssnano by default while also supporting csso, clean-css, esbuild, Lightning CSS, and SWC as drop-in minify backends (or a chained array of several). It taps directly into Webpack 5’s optimization.minimizer pipeline: matching assets by test/include/exclude regex, reusing Webpack’s persistent compilation cache to skip re-minifying unchanged output, and distributing work across a jest-worker process pool for parallel builds with full source-map tracing back through PostCSS.

The project’s README currently marks it deprecated in favor of the consolidated minimizer-webpack-plugin (CSS mode), which folds JS and CSS minification into one plugin going forward. It remains widely deployed today (9M+ weekly npm downloads) and still receives maintenance releases (v8.0.0 shipped March 2026) for existing Webpack 5 configurations, but new projects should evaluate the successor plugin before adopting this one.

What You Get

  • Pluggable minifier backends - ship with cssnanoMinify as the default, or switch to cssoMinify, cleanCssMinify, esbuildMinify, or lightningCssMinify via static exports on the plugin class.
  • Asset filtering - test/include/exclude options (regex, string, or array) control exactly which emitted assets get minified.
  • Webpack cache integration - unchanged assets are skipped on rebuild using Webpack’s own persistent compilation.getCache() keyed by content hash.
  • Parallel processing - minification is farmed out across a jest-worker pool sized to available CPU cores, with parallel: true|false|number to tune concurrency.
  • Source map support - respects Webpack’s devtool setting and re-maps warnings/errors back to original file:line:column via @jridgewell/trace-mapping.
  • Chained minifiers - pass an array of minify functions (each with matching minimizerOptions) to run multiple minifiers in sequence over the same asset.

Common Use Cases

  • Production CSS optimization - add new CssMinimizerPlugin() to optimization.minimizer alongside mini-css-extract-plugin to shrink extracted CSS bundles for production builds.
  • Swapping minifier engines - teams that want esbuild’s or Lightning CSS’s faster native minification instead of cssnano’s PostCSS-based pipeline set minify: CssMinimizerPlugin.esbuildMinify.
  • Filtering which stylesheets get minified - large monorepos use include/exclude to minify only certain output directories or skip already-minified vendor CSS.
  • Debugging minifier warnings - warningsFilter lets teams suppress known-noisy cssnano warnings (e.g. from third-party CSS) while still surfacing real issues.

Under The Hood

Architecture The plugin taps compiler.hooks.compilation and registers on compilation.hooks.processAssets at the PROCESS_ASSETS_STAGE_OPTIMIZE_SIZE stage, filtering candidate assets through Webpack’s ModuleFilenameHelpers.matchObject against the configured test/include/exclude rules. For each unminified asset it consults Webpack’s own persistent cache (compilation.getCache().getItemCache() keyed by a lazily-hashed etag) to skip work on unchanged content, then either dispatches to a jest-worker process pool or runs minify() inline, rebuilding output as RawSource/SourceMapSource instances via Webpack’s sources API. Concurrency is bounded by a small hand-rolled throttleAll task queue rather than an external promise-pool library. Swapping out the core Webpack dependency would require reworking every tap-hook registration, the Compilation.assets/cache calls, and the sources.* construction throughout src/index.js — the plugin has no abstraction layer separating it from Webpack’s internals.

Tech Stack Written as plain CommonJS with extensive JSDoc @typedef/@template annotations checked via tsc --noEmit, targeting Node >=20.9. Core runtime dependencies are cssnano ^7 (the default minifier), postcss ^8, @jridgewell/trace-mapping for source-map resolution, jest-worker ^30 for the parallel pool, schema-utils ^4 for option validation, and serialize-javascript ^7 to ship functions into worker processes. webpack ^5 is a peer dependency, and clean-css, csso, esbuild, @parcel/css, lightningcss, and @swc/css are all optional peers activated only when selected as the minify implementation. The build pipeline transpiles src/ to dist/ via Babel and generates .d.ts declarations with tsc --declaration --emitDeclarationOnly; tests run under Jest with memfs for in-memory filesystem fixtures.

Code Quality Thirteen dedicated spec files cover nearly every configuration surface (parallel, minify, minimizerOptions, warningsFilter, sourceMap, cache, include/exclude, test, worker, option validation) plus a core CssMinimizerPlugin.test.js suite, giving thorough regression coverage for a single-purpose plugin. Errors and warnings are wrapped into typed Error objects carrying file/line/column context rather than being swallowed, and schema-utils validates constructor options against a JSON Schema (src/options.json) before any build work runs. The heavy JSDoc typing is enforced in CI-equivalent lint:types, giving near-TypeScript safety without a TypeScript build step; ESLint 9 (flat config), Prettier, cspell, and commitlint/husky/lint-staged round out the toolchain.

API Design The public surface is a single constructor accepting one options object with sensible defaults (cssnano, /\.css(\?.*)?$/i test pattern), and every built-in minifier backend is exposed as a static property on the class itself (CssMinimizerPlugin.esbuildMinify, etc.), so switching implementations needs no extra imports. Passing an array to both minify and minimizerOptions chains multiple minifiers over the same asset with matching per-step options, which is a genuinely useful extension point, though the parallel/array-indexed option pairing does require reading the docs closely to use correctly. Getting started is a two-line addition to optimization.minimizer in an existing Webpack config.

Used by 14 apps in this directory

Python
50%
Other

Airbyte

Developer Tools · Data Engineering

21,998

Open-source ELT platform with 600+ connectors for moving data from any source to warehouses, lakes, and AI agents.

View details
95
Repo Health
80
Technical
66
Dependency
Built with
Python50%
Kotlin41%
Updated today
TypeScript
68%
Apache 2.0

Appsmith

Developer Tools · Automation · No Code Platforms

40,825

Open-source low-code platform to build admin panels, dashboards, and internal tools connected to any database or API.

View details
93
Repo Health
79
Technical
66
Dependency
Built with
TypeScript68%
Java21%
Updated 3 days ago
PHP
78%
Other

Craft CMS

CMS

3,605

A developer-first PHP CMS with clean-slate content modeling, auto-generated GraphQL API, and a four-tier edition system that scales from solo projects to enterprise deployments.

View details
96
Repo Health
83
Technical
62
Dependency
Built with
PHP78%
JavaScript14%
Updated yesterday
Ruby
40%
AGPL 3.0

DocuSeal

Digital Signiture

18,446

Open source document signing platform with WYSIWYG PDF builder, multi-party workflows, REST API, and full self-hosting via Docker.

View details
87
Repo Health
80
Technical
68
Dependency
Built with
Ruby40%
Vue28%
HTML20%
Updated 1 weeks ago
TypeScript
94%
AGPL 3.0

Element Web

Team Chat · Collaboration

13,437

A polished, self-hostable Matrix client for secure, decentralized messaging and collaboration that puts your organization in full control of its data.

View details
96
Repo Health
83
Technical
65
Dependency
Built with
TypeScript94%
Updated yesterday
TypeScript
49%
AGPL 3.0

Grafana

Monitoring · Analytics

76,643

The open-source observability platform that unifies metrics, logs, and traces from any data source into dynamic, queryable dashboards.

View details
95
Repo Health
91
Technical
63
Dependency
Built with
TypeScript49%
Go45%
Updated today
TypeScript
38%
Apache 2.0

Label Studio

AI Development · Data Engineering

28,222

Label Studio is an open-source, multi-type data labeling platform that lets teams annotate images, text, audio, video, and time series data with a configurable XML-based UI and export annotations in formats ready for any ML framework.

View details
93
Repo Health
87
Technical
67
Dependency
Built with
TypeScript38%
JavaScript27%
Python25%
Updated today
TypeScript
94%
AGPL 3.0

Laudspeaker

Marketing · Automation

2,620

Open-source customer engagement platform for building visual, event-triggered messaging journeys across email, SMS, push, in-app, and webhooks.

View details
51
Repo Health
66
Technical
62
Dependency
Built with
TypeScript94%
Updated 1 months ago
JavaScript
44%
Other

LimeSurvey

Forms Surveys

3,711

The world's most flexible open-source survey platform with 900+ templates, conditional logic, 80+ languages, and full GDPR compliance for any scale.

View details
85
Repo Health
62
Technical
62
Dependency
Built with
JavaScript44%
PHP34%
CSS12%
Updated 2 days ago

Join founders buildingwith open source

Opinionated takes, migration guides, cost-saving tips, and insights from the open source ecosystem.

Subscribe on Substack
Join 750+ subscribers

Search