Skip to content

Commit 181ce18

Browse files
committed
chore: add note about using generated types in the README
1 parent f63e285 commit 181ce18

File tree

1 file changed

+33
-0
lines changed

1 file changed

+33
-0
lines changed

README.md

+33
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ The project is literally the [clsx](https://www.npmjs.com/package/clsx) project
4949
flexDirection('flex-row-reverse'),
5050
);
5151
```
52+
5253
OR
5354

5455
```ts
@@ -172,6 +173,38 @@ type MyCustomType =
172173
...
173174
```
174175
176+
### How to use generated types
177+
178+
#### Method 1
179+
180+
import _the generated_ file (and **NOT** the actual library) into your code in order to get the customized classnames, like this:
181+
182+
```ts
183+
import {classnames} from 'path/to/generated/tailwindcss-classnames';
184+
```
185+
186+
#### Method 2
187+
188+
A more elegant approach is to add the generated file to your projects tsconfig.json compilerOptions paths which should allow you to keep the import the same and use your generated version of tailwindcss-classnames instead of the node_modules one.
189+
190+
```json
191+
{
192+
"compilerOptions": {
193+
"paths": {
194+
"tailwindcss-classnames": ["path/to/generated/tailwindcss-classnames"]
195+
}
196+
}
197+
}
198+
```
199+
200+
then:
201+
202+
```ts
203+
import {classnames} from 'tailwindcss-classnames';
204+
```
205+
206+
[From original comment by @andykenward](https://github.com/muhammadsammy/tailwindcss-classnames/discussions/227#discussioncomment-3101220)
207+
175208
### Known limitiations
176209

177210
- Relative imports inside the config does not work. use `__dirname` instead. See [#120](https://github.com/muhammadsammy/tailwindcss-classnames/issues/120) .

0 commit comments

Comments
 (0)