how to use generated custom classes? #227
-
Hey there, sorry if this is a silly question, what is the best way to use the generated classnames? i know im missing something but im pretty new to TS and im not even sure where to look |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 9 replies
-
Hello, @JeffBeltran! If you used the CLI you should import the generated file (and NOT the actual library) into your code in order to get the customized classnames, like this: DO: import { classnames } from "relative/path/to/generated/tailwindcss-classnames"; DO NOT import { classnames } from "tailwindcss-classnames"; as you won't get the custom/generated classnames from your config, instead you will have only the default tailwindcss classes. and then use the classnames as normal: import { classnames } from "relative/path/to/generated/tailwindcss-classnames";
const styles = classnames(.....); eg. if you generated the file in 'src/types/tailwindcss-classnames' and you want to use the generated file in 'src/index.ts', the code will be something like this: // src/index.ts
import { classnames } from "./types/tailwindcss-classnames";
const styles = classnames(.....); |
Beta Was this translation helpful? Give feedback.
Hello, @JeffBeltran!
If you used the CLI you should import the generated file (and NOT the actual library) into your code in order to get the customized classnames, like this:
DO:
DO NOT
as you won't get the custom/generated classnames from your config, instead you will have only the default tailwindcss classes.
and then use the classnames as normal:
eg. if you generated the file in 'src/types/tailwindcss-classnames' and you want to use the gen…