Turns out, CSS Modules comes with the same benefits while feeling much more like a natural extension to the web platform. The only thing I thoroughly miss is functions and directives, which hopefully will land in browsers through the mixins proposal in not too long of a time.
I don't recommend Tailwind CSS
51–60 of 179 posts
Re: I don't recommend Tailwind CSS
#52if you don't like this. .button { @apply py-2 px-4 bg-indigo-500 text-white font-semibold rounded-lg hover:bg-indigo-700 focus:bg-indigo-700; } why not write it like this? .button { @apply py-2 px-4 bg-indigo-500 text-white font-semibold rounded-lg hover:bg-indigo-700 focus:bg-indigo-700 ; }
.button {
padding: var(--gap-s) var(--gap-m);
background-color: var(--color-indigo);
color: var(--color-white);
font-weight: 700;
border-radius: var(--gap-s);
&:hover, &:focus {
background-color: var(--color-indigo-hover);
}
}
Fair comparison (i really don't like this too): .button { padding: var(--gap-s) var(--gap-m); background-color: var(--color-indigo); color: var(--color-white); font-weight: 700; border-radius: var(--gap-s); &:hover, &:focus { background-color: var(--color-indigo-hover); } }
;-)Re: I don't recommend Tailwind CSS
#53I see you have a .button, cool! So did you load the entire context of your project into your mind, and calculate every possible iteration of kind, size, color etc this button may have? And once you did that, did you come up with a semantically correct naming scheme that is clear and will not succumb to the inevitable .button_checkout_special_page_cta_widget a particular page will end up requiring? No? Neither did I.…
Re: I don't recommend Tailwind CSS
#54Re: I don't recommend Tailwind CSS
#55The hilarious thing here is that without JavaScript, the code is white-on-white, because some of the colouring is added on pre[class*="language-"], but the language-css class is only added to the pre element by JS.
Re: I don't recommend Tailwind CSS
#56if you don't like this. .button { @apply py-2 px-4 bg-indigo-500 text-white font-semibold rounded-lg hover:bg-indigo-700 focus:bg-indigo-700; } why not write it like this? .button { @apply py-2 px-4 bg-indigo-500 text-white font-semibold rounded-lg hover:bg-indigo-700 focus:bg-indigo-700 ; }
And how did plain css solve that? You're mixing up a few issues there.
Re: I don't recommend Tailwind CSS
#57Earlier quoted context omitted.
I feel like scoped css and component libraries fixed this issue. I don’t have a .button, I just have a that has all its css self contained. And just a shared color definition file.
Same, my need for tailwind got completely ridden when I started using Svelte, thanks to the CSS-scoping it entailed.
Re: I don't recommend Tailwind CSS
#58This is such a bikeshedding debate. While you don't recommend it, projects with Tailwind work . Over years. You can onboard new developers to it, able to contribute productively immediately . Likewise, you can pick up work after months or years and don't have to remember or rediscover how your styling layer works. The conventions and class names come really naturally fast, and you can always look it up. It's just not…
It's a red flag (ha).
Re: I don't recommend Tailwind CSS
#59For my own projects, I have been perfectly fine with just one large global CSS file, extending it just when I have to. But I could this being maybe tedious when working in a large team.
Re: I don't recommend Tailwind CSS
#60I personally started with atomic CSS framework (that was before Tailwind, we had our own) and it has both ups and downs, but overall it is really nice to use once you learn it, and it is not really hard to do so. It does not do anything to enforce variables, but that's why you need to roll either your own layout primitive components or some classes.