Skip to content

One of my classes gets erased if I write it in the "wrong" order #88

Closed Answered by dcastil
JackUait asked this question in Help
Discussion options

You must be logged in to vote

Hi @JackUait! 👋

The object passed to extendTailwindMerge is incorrect. tailwind-merge only supports some theme keys, in your case only borderRadius.

Try out this one, that should make it work:

const twMerge = extendTailwindMerge({
  theme: {
    borderRadius: Object.keys(theme.borderRadius),
  },
  classGroups: {
    'font-size': [{ text: Object.keys(theme.fontSize) }],
    shadow: [{ shadow: Object.keys(theme.boxShadow) }],
    'font-weight': [{ font: Object.keys(theme.fontWeight) }],
  },
})

I created a reproduction example for it here: https://codesandbox.io/s/tailwind-merge-playground-discussion-88-p5fmg0

Let me know if that helps 😊

Replies: 1 comment 1 reply

Comment options

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

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