Re:Play with TailwindCSS in the Browser
by meowtimemania on Friday June 10, 2022 @04:00PM
(#31698760)
One gripe I have with tailwind, is overriding styles is difficult. The .text-blue style will only override .text-gray if it is declared later in the css document.
for example if the corresponding css file is this: .text-blue { color: blue; } .text-gray { color: gray; }
Then in your above example, both Button and CalloutButton will have gray text because .test-gray has higher specificity than .text-blue
The difference is that your website will be much larger and won't work without JavaScript.
Re:Play with TailwindCSS in the Browser
by LouisSayers on Friday June 10, 2022 @10:34AM
(#31694784)
And what about your :hover, ::before etc, where do you put those? (genuinely curious)
Those have utility classes: https://tailwindcss.com/docs/hover-focus-and-other-states
<Button class=`border text-gray ${override}`/>
<CalloutButton /> extends <Button override="text-blue" />
I'd argue you have less markup to write overall if you are modularizing component logic/styling