https://github.com/umami-software/esbuild-plugin-css-modules
esbuild plugin for bundling CSS modules with PostCSS
https://github.com/umami-software/esbuild-plugin-css-modules
css css-modules esbuild esbuild-plugin
Last synced: 4 months ago
JSON representation
esbuild plugin for bundling CSS modules with PostCSS
- Host: GitHub
- URL: https://github.com/umami-software/esbuild-plugin-css-modules
- Owner: umami-software
- License: mit
- Created: 2024-12-19T22:02:59.000Z (over 1 year ago)
- Default Branch: master
- Last Pushed: 2024-12-20T03:23:43.000Z (over 1 year ago)
- Last Synced: 2025-10-28T05:32:12.520Z (8 months ago)
- Topics: css, css-modules, esbuild, esbuild-plugin
- Language: JavaScript
- Homepage:
- Size: 12.7 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# @umami/esbuild-plugin-css-modules
A esbuild plugin for bundling CSS modules using [PostCSS](https://postcss.org/).
## Install
```shell
npm install @umami/esbuild-plugin-css-modules
```
## Usage
The plugin accepts the available options from [postcss-modules](https://github.com/madyankin/postcss-modules).
```javascript
import esbuild from 'esbuild';
import cssModules from '@umami/esbuild-plugin-css-modules';
// postcss-modules plugin options
const options = {};
esbuild
.build({
entryPoints: ['src/index.js'],
outfile: 'dist/index.js',
plugins: [cssModules(options)],
})
.catch(e => {
console.error(e);
process.exit(1);
});
```
After the build process, you will have a CSS file `dist/index.css` with class names in the format
of `[name]_[local]__[hash]`. You can pass in your own `generateScopedName` function to modify the
default behavior.
## License
MIT