Replies: 1 comment
-
This isn't a direct solution to your question (I don't think there is anything that exists) but Adam Wathan (creator of Tailwind) does seem to advocate avoiding
In essence, consider using your templating system to convert -<a … class="link-default">
+<a … class="text-links no-underline"> -<a … class="link-nav">
+<a … class="
+ text-headings whitespace-nowrap underline-offset-4 text-lg
+ hover:text-links-hover focus:text-links-hover focus:underline active:text-links-hover
+"> You could then use logic in your templates to override these classes for others when needed too. |
Beta Was this translation helpful? Give feedback.
0 replies
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.
-
I had components utility in v3 defined like this, it allowed that links have default color of
text-links
, and in navigation links that color is overridden totext-headings
. It worked fine becauselink-nav
utility was defined second.In v4 I had to define two utilities like this, now they are two separate utilities and definition order doesn't affect specificity so rules from
link-nav
don't win and links still have default color.I don't want to use
!important
because I have other link variants too where I would then need to use!!important
and would quickly create a mess. I have to define utilities because I use these classes with@apply
.How to control specificity in v4 utilities in a proper way?
Beta Was this translation helpful? Give feedback.
All reactions