Classnames Minifier (v4.1.1) is a library for configuring CSS modules to generate compressed class names, reducing bundle size and improving obfuscation. It integrates with Webpack's css-loader to minify class names in real-time during build. Compared to alternatives like css-minimizer-webpack-plugin or custom loaders, it specifically targets class name length and provides fine-grained control over naming patterns. Active development, with patches released monthly.
npm install classnames-minifierNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Configure Webpack css-loader to minify CSS module class names using default settings.
Use ES module syntax: import classnamesMinifier from 'classnames-minifier'.
Switch to default import: import classnamesMinifier from 'classnames-minifier'.
Update css-loader to version >=4.0.0 or use a compatible version.
Ensure your CSS files have .module.css extension or module rule.
Replace const classnamesMinifier = require('classnames-minifier') with import classnamesMinifier from 'classnames-minifier'.Run npm install classnames-minifier css-loader.
Use modules.getLocalIdent or modules.localIdentName; refer to css-loader documentation.