Re:Tailwind CSS v3.2: revisiting my “feature creep” warning
by Raymonf on Saturday October 22, 2022 @12:14PM
(#33299544)
By "base CSS" are you referring to using @apply? That's generally not recommended from what I understand, with componentization and reuse being preferred over most usages of @apply for this purpose.
Re:Tailwind CSS v3.2: revisiting my “feature creep” warning
by shubhamjain on Saturday October 22, 2022 @12:19PM
(#33299616)
I feel us programmers should be open to breaking rules in favor of convenience. I don't see an issue to why you can't use `p:not(:first-child) { margin-top: 12px; }` just because you're using Tailwind (that particular rule gives a margin to every paragraph except the first one which is usually needed in articles). The most productive programmers I have seen frequently disregarded best practices if it suited the situation.
Re:Tailwind CSS v3.2: revisiting my “feature creep” warning
by silvenon on Monday October 24, 2022 @02:39PM
(#33320607)
You mean like this supported utility class `[&_p:not(:first-child)]:mt-[12px]`?
Re:Tailwind CSS v3.2: revisiting my “feature creep” warning
by brycewray on Saturday October 22, 2022 @12:17PM
(#33299580)
Re `@apply`, that's correct, per Adam Wathan himself[0]:
> Confession: The `apply` feature in Tailwind basically only exists to trick people who are put off by long lists of classes into trying the framework
> You should almost never use it
> Reuse your utility-littered HTML instead.
[0]: https://twitter.com/adamwathan/status/1226511611592085504
Re:Tailwind CSS v3.2: revisiting my “feature creep” warning
by yawnxyz on Saturday October 22, 2022 @04:27PM
(#33301900)
I tried to avoid using @apply but that makes creating variations (e.g. of button styles) REALLY hard — as your code is just littered with class names. Plus if you're adding :active :hover and :focus styles, you have to do it on ALL the variations on all of the pages. It's frustrating and takes a really long time.
I've moved to using @apply in a few generalized classes and I love it, since my class names like "btn" "btn-success" "btn-success-outline" describes what I want, and I can easily go in and change them.
I'm not creating a new component for every tiny thing, like a button or a link, just so I can avoid using @apply...
Re:Tailwind CSS v3.2: revisiting my “feature creep” warning
by systemvoltage on Saturday October 22, 2022 @12:21PM
(#33299633)
Tailwind is moderately useful but not the panacea people are looking for or they’re being told.
I style things normally in CSS with exceptions or one-offs that are styled in tailwind classes. Usually try to avoid those.
Re:Tailwind CSS v3.2: revisiting my “feature creep” warning
by phreack on Sunday October 23, 2022 @03:18AM
(#33305199)
I think Tailwind only shines alongside a component system like React where you can just create a new Paragraph tag and reuse that. It makes me very happy because in the end there's way less code for me to read and understand, and changes are obvious, immediate and easy to do.
While I agree, sometimes I feel Tailwind users forget that writing regular CSS is also an option. I have seen examples where developers repeat Tailwind classes for every paragraph, every link. They repeat same typography styles over and over again instead of creating some base CSS. A great example is this checkbox[1] where developers used 71 Tailwind classes to style the input.
[1]: https://twitter.com/hovhaDovah/status/1461672155108806658