Registry / devops / esbuild-plugin-cssm

esbuild-plugin-cssm

JSON →
library1.2.6jsnpmunverified

A minimal CSS Modules plugin for esbuild, version 1.2.6, forked from esbuild-plugin-simple-css-modules. It uses PostCSS as its sole dependency to transform CSS Module files (.module.css) into scoped class names and IDs, appending a hash of the filepath by default. Supports animation names, multiple selectors, and custom transform callbacks. Compatible with esbuild >=0.14.x and Node >=14.x. Ships TypeScript type definitions.

npm install esbuild-plugin-cssm
INSTALL
IMPORT
SIG · ESBUILD-PLUGIN-CSS
E
esbuild-plugin-cssm
devopsjavascriptv1.2.6
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

cssm
import cssm from 'esbuild-plugin-cssm'
ESM default export; also works with require('esbuild-plugin-cssm').default in CommonJS.

Basic esbuild setup using the cssm plugin to process CSS Modules in .module.css files.

import { build } from 'esbuild'; import cssm from 'esbuild-plugin-cssm'; import path from 'path'; build({ entryPoints: ['src/index.js'], bundle: true, outfile: 'out/bundle.js', plugins: [ cssm({ hashLength: 6, prefix: '', }), ], }).catch(() => process.exit(1));
Debug
Known issues
gotchaEnsure .module.css files are not processed by other CSS loaders/plugins to avoid double processing.
fix
Configure only this plugin for .module.css files, or use esbuild's loader to exclude them.
affects: all
gotchaHash length max is 28; values >28 may cause errors.
fix
Clamp hashLength to 28 or upgrade to latest version which may enforce this.
affects: <1.2.6
Upgrade
Version history
1.2.6latest on npm
Audit
Dependencies
esbuildrequiredpeer dependency required to function as a plugin
Agent activity
2 hits · last 30 days
node
2
Resources
esbuild-plugin-cssm — npm install esbuild-plugin-cssm · libregistry