Replies: 1 comment
-
Hey @wyozi! 👋 You can do that surprisingly easily! Basically you want to add a prefixed version of every classGroup to the classGroup. This should do the trick: const twMerge = createTailwindMerge(() => {
const config = getDefaultConfig()
return {
...config,
classGroups: Object.fromEntries(
Object.entries(config.classGroups).map(([key, value]) => {
return [key, [...value, { tw: value }]]
})
),
}
})
twMerge('block tw-inline text-blue-500 tw-text-red-500 tw-px-4 p-3')
// → returns 'tw-inline tw-text-red-500 p-3' |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hey!
I have a bit of a possibly weird usecase, where I'm mixing a design system package
uikit
with all kinds of Buttons and Spinners with a regular frontend packageclient
. Theuikit
package usesprefix: 'tw-'
due to compatibility reasons whereasclient
doesn't use prefix at all.I would like to merge tailwind classes passed to
uikit
'sButton
from theclient
codebase, but there is a problem in that tailwind classes used byclient
don't have any prefix while tailwind classes used byuikit
are all prefixed withtw-
, hence breaking the merge process.Is there any solution to this or would it require supporting multiple prefixes in merge configuration?
Beta Was this translation helpful? Give feedback.
All reactions