Add config option to ignore variants/modifiers#440
Add config option to ignore variants/modifiers#440barvian wants to merge 1 commit intodcastil:mainfrom
Conversation
|
Hey @barvian! 👋 Thanks for your PR, I appreciate that a lot. Also congrats on your plugin, that looks cool! I try to keep tailwind-merge focused on the default use cases when using vanilla Tailwind CSS with a few changes to the config to keep the library simple, fast and flexible enough for future features of Tailwind CSS. So I'm afraid it wouldn't fit very well to add the I see that this doesn't work with your plugin and there were also requests for other more advanced use cases. I want to expose a lower-level API so that tailwind-merge works with all those use cases in #385 (just added this PR as an example there). Would it be helpful to you if I instead create this API that allows you to deeply customize the behavior of tailwind-merge to work with your plugin? It probably wouldn't be a config but rather a new function that returns an object with a bunch of low-level util functions (including the |
|
Thanks for the review! I totally understand not wanting to support this feature. As for the new API, I'm sure it'd be useful! I'll close this PR and create a new one for the typo/comment fixes 🙂 |
|
Alright, I'll take your use case into account and let you know once it is done. |
|
@barvian just merged #444 which adds an You should be able to use that to build a tailwind-merge plugin in case you want to build it. But be aware that the API might change in a minor update. I see this as a smaller stepping stone on the way to getting to a separate API that allows even more stuff. |
|
@dcastil Amazing, I'll play around with this! Thank you! |
Hi! Thanks a lot for the library! Sorry to submit a PR out of the blue, but it was so small that I thought starting a discussion first would be overkill.
I'm trying to use tailwind-merge with a third-party Tailwind plugin I created but I'm running into some issues. Unlike most Tailwind variants, the variants in my plugin change a utility's properties, not its selector (I've seen this in other plugins as well). Currently, these types of variants don't work well with tailwind-merge, because it (reasonably) treats them as normal variants when ideally they would be ignored.
As a potential solution, I added an
ignoredVariantsarray (default:[]) to the config for variants that should be ignored when merging classes. Do you think you'd be interested in adding a feature like this? I'd love to improve my plugin's compatibility with tailwind-merge (my users would appreciate it as well 😅)Thanks!