Skip to content

tw-merge configuration documentation #414

Answered by dcastil
joshytaco asked this question in Help
Discussion options

You must be logged in to vote

Hey @joshytaco! 👋 Thanks for bearing with me, I was away from my computer for a week.

Oh yeah, I think the documentation doesn't mention this indeed. tailwind-merge is just a normal runtime function, so the configuration should be wherever your runtime is. If you're using tailwind-merge in the browser, then just put it where your code that runs in the browser is. I usually create a file like tailwind-merge.ts in a utils folder and then add this code to it:

import { extendTailwindMerge } from 'tailwind-merge'

export const twMerge = extendTailwindMerge({
    // my config here
})

Then I import the twMerge function from that file wherever I need it.

By the way regarding your comment

e.g. cl…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@joshytaco
Comment options

Answer selected by joshytaco
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Help
Labels
context-v2 Related to tailwind-merge v2
2 participants