Replies: 1 comment 2 replies
-
Hey @unional! 👋 Prefixes can be any string, including strings that look like Tailwind CSS classes. Therefore tailwind-merge can handle classes with multiple different prefixes (#296 (comment)), but for that you'd need to know all possible prefixes and using too many can cause runtime performance issues. Is there a way you could figure out what is or isn't a prefix? E.g. could you imagine using a function to determine the prefix? I'm thinking of something like this: const twMerge = createTailwindMerge({
prefix: (className: string) => {
// return className without prefix
}
}) |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I'm working on a MFE application and each MFE uses their own prefixes.
They share components among each others.
So when finally applying the tailwind classes to a component, they can contain classes with different prefixes.
So
twMerge = createTailwindMerge({ prefix: 'x-' })
does not work.We either need to somehow specify all possible prefixes (not really feasible, unless it is created by the host which may know every application loaded), or have a way to specify
hasPrefix: true
and the function will ignore the prefix automatically.Beta Was this translation helpful? Give feedback.
All reactions