Need help with my Tailwind modifier custom function #17279
Unanswered
south-nova
asked this question in
Help
Replies: 1 comment 1 reply
-
In short, this isn't possible. As per the documentation, Tailwind relies on seeing the literal string
|
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I've created a twModifier function to simplify using Tailwind modifiers.
twModifier('max-md', 'flex-col w-full gap-8 bg-primary')
When used like this, it returns:
'max-md:flex-col max-md:w-full max-md:gap-8 max-md:bg-primary'
It's a simple utility function that returns a string with Tailwind utility classes applied.
However, there's an issue: some styles aren't actually being applied.
In the example above, flex-col and w-full are applied, but gap-8 and bg-primary are not.
How can I resolve this issue? 😢🙏
Beta Was this translation helpful? Give feedback.
All reactions