Skip to content

Commit ec3bf16

Browse files
authored
feat!: make opts.pattern required (#17)
1 parent 007d7ed commit ec3bf16

File tree

2 files changed

+3
-9
lines changed

2 files changed

+3
-9
lines changed

Diff for: README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,6 @@ import { defineConfig } from "vite";
1919
import happyCssModules from "vite-plugin-happy-css-modules";
2020

2121
export default defineConfig({
22-
plugins: [happyCssModules()],
22+
plugins: [happyCssModules({ pattern: "src/**/*.module.{css,scss,less}" })],
2323
});
2424
```

Diff for: src/index.ts

+2-8
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,12 @@
11
import { run } from "happy-css-modules";
22
import type { Plugin } from "vite";
33

4-
const DEFAULT_PATTERN = "**/*.module.{css,scss,less}";
4+
export type Options = Omit<Parameters<typeof run>[0], "watch">;
55

6-
export type Options = Omit<Parameters<typeof run>[0], "pattern" | "watch"> & {
7-
pattern?: string;
8-
};
9-
10-
export default function happyCssModules(opts?: Options): Plugin {
11-
const pattern = opts?.pattern ?? DEFAULT_PATTERN;
6+
export default function happyCssModules(opts: Options): Plugin {
127
const declarationMap = opts?.declarationMap ?? true;
138

149
const runnerOptions = {
15-
pattern,
1610
watch: false,
1711
declarationMap,
1812
...opts,

0 commit comments

Comments
 (0)