You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If someone wants to add classes to the tailwind-merge config, that's no problem.
consttwMerge=extendTailwindMerge({classGroups: {// additions to the config go here}})
But if someone wants to override the config in some places, that gets nasty really fast
consttwMerge=createTailwindMerge(()=>{// Need to import this function and create default config myselfconstconfig=getDefaultConfig()// Do I mutate the config?config.classGroups.somethingThatExists=[]// Do I mutate arrays? What if arrays are reused?config.classGroups.somethingElseThatExists.push({})// Feels weirdly imperativereturnconfig})
It would be really nice if I could override parts of the config declaratively and safely with extendTailwindMerge. I think I could use the same pattern as Tailwind CSS and rely on a extend key in each object to add config to existing one and keep the current config to override elements like this:
consttwMerge=extendTailwindMerge({classGroups: {// overrides to the config go hereextend: {// additions to the config go here}}})
This would be a breaking change and therefore only makes sense in a new major version.
The text was updated successfully, but these errors were encountered:
Another idea is to use a different name. extendTailwindMerge doesn't sound very fitting if you can also override. This would also make it possible to ship this as a non-breaking change or make the breaking change more obvious.
If someone wants to add classes to the tailwind-merge config, that's no problem.
But if someone wants to override the config in some places, that gets nasty really fast
It would be really nice if I could override parts of the config declaratively and safely with
extendTailwindMerge
. I think I could use the same pattern as Tailwind CSS and rely on aextend
key in each object to add config to existing one and keep the current config to override elements like this:This would be a breaking change and therefore only makes sense in a new major version.
The text was updated successfully, but these errors were encountered: