Priorities
See original GitHub issueWhen I use both p-7
and p-3
in any order the p-7
wins.
In both <div class="p-3 p-7"></div>
and <div class="p-7 p-3"></div>
, The p-7
applies.
I know that I should use on of them but sometimes I need to apply the same property and override the previous one.
Issue Analytics
- State:
- Created 3 years ago
- Comments:6 (2 by maintainers)
Top Results From Across the Web
Priority Definition & Meaning - Merriam-Webster
The meaning of PRIORITY is the quality or state of being prior. How to use priority in a sentence.
Read more >Priorities USA
Priorities USA is a voter-centric progressive advocacy organization and service center for the grassroots progressive movement.
Read more >Priorities definition and meaning | Collins English Dictionary
Priorities definition: the condition of being prior ; antecedence ; precedence | Meaning, pronunciation, translations and examples.
Read more >Meaning of priority in English - Cambridge Dictionary
something that is considered more important than other matters: [ C ] The president vowed to make education one of his top priorities....
Read more >Priorities | The White House
The Biden-Harris Administration Immediate Priorities · COVID-19 · Climate · Racial Equity · Economy · Health Care · Immigration · Restoring America's Global...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I do face this problem a lot when building some components. Let’s say you have a button component and by default you always apply a blue background. So you add the class
bg-blue
.Many frameworks provide the ability to customize classes applied to the element from the outside.
It is very tempting to write something like this if you want a red button
however, the resulting HTML from this component call is
if bg-blue comes last in the css file, then it “wins” and the button will not be red.
To solve this I thought about creating a “default” variant, that always comes before any normal utilities. That way the resulting html would be:
Which should work because any
default:*
should come before the regular variant (or absence of variant).Is this possible to do? Do you foresee any problems with this?
Of course, this would have to be used sparingly, only on things that we want to provide a default for and PurgeCSS should help the file sizes to stay low.
@fedeci Thanks for the advice 😅