Skip to content

how to use generated custom classes? #227

Answered by muhammadsammy
JeffBeltran asked this question in Q&A
Discussion options

You must be logged in to vote

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 gen…

Replies: 1 comment 9 replies

Comment options

You must be logged in to vote
9 replies
@JeffBeltran
Comment options

@ChristopherML
Comment options

@andykenward
Comment options

@jamesarosen
Comment options

@muhammadsammy
Comment options

Answer selected by JeffBeltran
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
5 participants