Skip to content

Commit 6cb52a0

Browse files
committed
update documentation
1 parent 813f19f commit 6cb52a0

2 files changed

Lines changed: 31 additions & 31 deletions

File tree

README.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,23 @@ In TypeScript, the `include`/`exclude` properties specify which `*.ts` files to
127127
}
128128
```
129129

130+
### `cmkOptions.enabled`
131+
132+
Type: `boolean`, Default: `undefined`
133+
134+
Enables or disables css-modules-kit. When set to `false`, codegen will exit with an error. Currently, both codegen and the ts-plugin will work even if this option is omitted, but in the future, they will not work unless this option is set to `true`. For more details, see [#289](https://github.com/mizdra/css-modules-kit/issues/289).
135+
136+
```jsonc
137+
{
138+
"compilerOptions": {
139+
// ...
140+
},
141+
"cmkOptions": {
142+
"enabled": true,
143+
},
144+
}
145+
```
146+
130147
### `cmkOptions.dtsOutDir`
131148

132149
Type: `string`, Default: `"generated"`

docs/get-started.md

Lines changed: 14 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -47,50 +47,33 @@ Configure npm-script to run `cmk` command before building and type checking. Thi
4747

4848
## Configure `tsconfig.json`
4949

50-
Finally, you need to configure your tsconfig.json so that the ts-plugin and codegen work correctly.
51-
52-
- Set the `include` option so that files like `*.module.css` are considered for type-checking:
53-
- For example: `["src"]`, `["src/**/*"]`, or omitting the `include` option (which is equivalent to `["**/*"]`)
54-
- Not recommended: `["src/**/*.ts"]`, `["src/index.ts"]`
50+
Finally, you need to configure your tsconfig.json so that css-modules-kit works correctly.
51+
52+
- Set `cmkOptions.enabled` to `true` to enable css-modules-kit.
53+
- Omit the `include` options or ensure that `*.module.css` files are included when specifying them explicitly.
54+
- ✅ Good cases:
55+
- Omit `include` (equivalent to `["**/*"]`)
56+
- Use patterns like `["src"]`, `["src/**/*"]`
57+
- ❌ Bad cases:
58+
- `["src/**/*.ts"]`
59+
- `["src/index.ts"]` (excludes `*.module.css` files)
5560
- Set the `rootDirs` option to include both the directory containing `tsconfig.json` and the `generated` directory.
5661
- Example: `[".", "generated"]`
5762

5863
Below is an example configuration:
5964

6065
```jsonc
6166
{
62-
// Omitting the `include` option is equivalent to using `["**/*"]`
6367
"compilerOptions": {
64-
/* Projects */
6568
"rootDirs": [".", "generated"],
66-
67-
/* Language and Environment */
68-
"target": "ESNext",
69-
"lib": ["ESNext"],
70-
71-
/* Modules */
72-
"module": "NodeNext",
73-
"moduleResolution": "NodeNext",
74-
75-
/* Emit */
76-
"noEmit": true,
77-
78-
/* Interop Constraints */
79-
"verbatimModuleSyntax": true,
80-
"esModuleInterop": true,
81-
"forceConsistentCasingInFileNames": true,
82-
83-
/* Type Checking */
84-
"strict": true,
85-
86-
/* Completeness */
87-
"skipLibCheck": true,
69+
// ...
70+
},
71+
"cmkOptions": {
72+
"enabled": true,
8873
},
8974
}
9075
```
9176

92-
This completes the minimal setup.
93-
9477
## Install linter plugin (Optional)
9578

9679
We provide linter plugin for CSS Modules. Currently, we support the following linters:

0 commit comments

Comments
 (0)