Need help with custom tailwind.config.js and extendTailwindMerge #278
-
Can't figure out how to correctly implement extendTailwindMerge with values from my custom tailwind.config.js. custom tw merge function
tailwind.config.js
|
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Hey @frankspin89! 👋 All the info on how to configure tailwind-merge is here: https://github.com/dcastil/tailwind-merge/blob/v1.14.0/docs/configuration.md tailwind-merge doesn't support all theme keys, only a few are supported. A list of the supported keys is at https://github.com/dcastil/tailwind-merge/blob/v1.14.0/docs/configuration.md#theme. Here is a breakdown of the config you need and why:
const customTwMerge = extendTailwindMerge({
classGroups: {
// https://github.com/dcastil/tailwind-merge/blob/v1.14.0/src/lib/default-config.ts#L1188
shadow: ['shadow-card'],
// https://github.com/dcastil/tailwind-merge/blob/v1.14.0/src/lib/default-config.ts#L619
'font-size': [
{ text: ["h1", "h2", "h3", "h4", "h5", "h6", "titles", "display"] },
],
// https://github.com/dcastil/tailwind-merge/blob/v1.14.0/src/lib/default-config.ts#L1381
animate: [
{ animate: ['slideDownAndFade', 'slideLeftAndFade', 'slideUpAndFade', 'slideRightAndFade'] },
],
},
}) |
Beta Was this translation helpful? Give feedback.
Hey @frankspin89! 👋
All the info on how to configure tailwind-merge is here: https://github.com/dcastil/tailwind-merge/blob/v1.14.0/docs/configuration.md
tailwind-merge doesn't support all theme keys, only a few are supported. A list of the supported keys is at https://github.com/dcastil/tailwind-merge/blob/v1.14.0/docs/configuration.md#theme.
Here is a breakdown of the config you need and why:
maxWidth.8xl
not needed as T-shirt sizes are supported by default: https://github.com/dcastil/tailwind-merge/blob/v1.14.0/src/lib/default-config.ts#L594borderRadius.4xl
not needed as T-shirt sizes are supported by default: https://github.com/dcastil/tailwind-merge/blob/v1.14.0/src/lib/default-con…