0.1.2 • Published 7 months ago

esbuild-plugin-auto-css-modules v0.1.2

Weekly downloads
-
License
MIT
Repository
github
Last release
7 months ago

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
}

Related