esbuild-plugin-auto-css-modules
TypeScript icon, indicating that this package has built-in type declarations

0.1.2 • Public • Published

esbuild-plugin-auto-css-modules

npm version License: MIT issues PRs Welcome downloads Code Coverage Node.js CI

Automatically import styles filename mark CSS modules. After adding the flag, the build tool can distinguish whether to enable css Modules

Install

npm i esbuild-plugin-auto-css-modules -D

Usage

import { build } from 'esbuild'
import { autoCssModules } from 'esbuild-plugin-auto-css-modules'

build({
  entryPoints: ['src/index.js'],
  bundle: true,
  outfile: 'dist/index.js',
  plugins: [autoCssModules()],
}).catch(() => process.exit(1))
// before
import styles from './index.css';
// after
import styles from './index.css?modules';

Options

type Options = {
    filter?: RegExp; // default: /\.([tj]sx?)$/
    flag?: string; // default: modules
    ignore?: RegExp | ((filename: string) => boolean); // default: null
}

Package Sidebar

Install

npm i esbuild-plugin-auto-css-modules

Weekly Downloads

314

Version

0.1.2

License

MIT

Unpacked Size

11.7 kB

Total Files

6

Last publish

Collaborators

  • noyobo