Skip to content

umami-software/esbuild-plugin-css-modules

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

@umami/esbuild-plugin-css-modules

A esbuild plugin for bundling CSS modules using PostCSS.

Install

npm install @umami/esbuild-plugin-css-modules

Usage

The plugin accepts the available options from postcss-modules.

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

About

esbuild plugin for bundling CSS modules with PostCSS

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published