I was in the camp "this-is-bullshit" until recently. It felt backwards. We recently switched to Tailwind for one of our projects, and Tailwind was a delight to use, especially with its VS Code extension. Code readability is surprisingly not that big of a deal because we use components. Of course if you are looking at the raw HTML in chrome tools, it can get disorienting. For folks that are worried about having to lea…
Play with TailwindCSS in the Browser
61–70 of 300 posts
Re: Play with TailwindCSS in the Browser
#62
How is mushing every single style into a class attribute supposed to help with readability and maintainability? Even if you use `@apply` to reduce the clutter, you are basically venturing back into "vanilla" CSS territory, and which their docs expressly said to avoid (https://tailwindcss.com/docs/reusing-styles#avoiding-prematu...).And even if I decided to march forward with tailwind CSS despite all of this, how do I format the code? Break up the classes for different states into separate lines, like so?
Yeah, I do not see how this is more readable than plain CSS. Is all of this worth it, just to avoid having the developer think up of class names, or defining their own theme using CSS variables?Re: Play with TailwindCSS in the Browser
#63Earlier quoted context omitted.
How does it affect quality?
Tailwind means making your HTML non-semantic, usually backed by JavaScript. This has created an arms race where parsers such as screen readers need to do ever-evolving heuristics to provide a reader mode. The code usually cannot be modified or even viewed in a readable form by users. Of all things, it's not user-centric. You're going to tell me next that you have a JSON interface instead. But that's a site-specific A…
First, Tailwind has literally no opinion on whether your html is semantic or not. Second, it isn't "backed by javascript", that's nonsense and is just self-evidently not true. Third, "people with slow browsers" benefit because the CSS footprint is smaller. Fourth, the quality of the site improves with Tailwind because developers can spend their unused energy on other enhancements.
Why get on this thread and spew a bunch of bullshit? What's the point dude.
Re: Play with TailwindCSS in the Browser
#64I cannot believe how anyone can look at the following code below and think that it's maintainable, just for an input box with additional styles for states: How is mushing every single style into a class attribute supposed to help with readability and maintainability? Even if you use `@apply` to reduce the clutter, you are basically venturing back into "vanilla" CSS territory, and which their docs expressly said to av…
Re: Play with TailwindCSS in the Browser
#65I cannot believe how anyone can look at the following code below and think that it's maintainable, just for an input box with additional styles for states: How is mushing every single style into a class attribute supposed to help with readability and maintainability? Even if you use `@apply` to reduce the clutter, you are basically venturing back into "vanilla" CSS territory, and which their docs expressly said to av…
Yes. You're starting out with a well thought out set of variables & themes. You can tweak if you need. You can add extensions. There are lots of HTML/CSS components written for Tailwind online you can copy/pasta into your project.
But for me the biggest win is just having a ton of variables I can use. I also only use it when building component type architecture & I try to keep my components small & focused.
Re: Play with TailwindCSS in the Browser
#66Im sorry but I don’t understand how anyone can look at that and think it’s a good way to build UIs. I’m almost certainly in the wrong, considering how popular this library seems to be getting, but holy heck that looks like a tedious mess to work with. It’s like you have to learn every raw CSS selector, and then also learned how it’s represented in Tailwind, and then scatter that all over your markup.
Re: Play with TailwindCSS in the Browser
#67I cannot believe how anyone can look at the following code below and think that it's maintainable, just for an input box with additional styles for states: How is mushing every single style into a class attribute supposed to help with readability and maintainability? Even if you use `@apply` to reduce the clutter, you are basically venturing back into "vanilla" CSS territory, and which their docs expressly said to av…
Where it shines is when you're not looking at primitives. Most dev work is pushing pixels around for layouts making things responsive, padding, margins, flex direction stuff. And in those cases Tailwind shines because you aren't constantly trying to come up with class names around div and sections. You are authoring you're css right with your markup. The productivity gains is unlike any other tool you can introduce to an org.
Going back and reading a component and making modifications is incredibly nice too because I can just understand everything that's happening right out the gate. I'm not going back and forth between 2 or 3 files and trying to un nest complicated SCSS in my head.
Re: Play with TailwindCSS in the Browser
#68Im sorry but I don’t understand how anyone can look at that and think it’s a good way to build UIs. I’m almost certainly in the wrong, considering how popular this library seems to be getting, but holy heck that looks like a tedious mess to work with. It’s like you have to learn every raw CSS selector, and then also learned how it’s represented in Tailwind, and then scatter that all over your markup.
It pushes you to componentize common UI elements. Feel bad to have long utility classes that look like . Change it to: Submit using whatever tooling you prefer. If you don't use this style, maybe you won't like it. I've found it's a waste of time to extract classes for items that are not repeated. And putting utilities in components lightens your "master" CSS file and makes it a lot easier to work with CSS. I've foun…
Even when you do that, you're still delivering the long, repetitive mark-up to the browser, rather than relying on the CSS engine to handle this for you. You're making the DOM MUCH MUCH heavier than it needs to be and ignoring the rendering engine that's optimised to handle this role. It seems wasteful all 'round. I confess I'm guessing here, and haven't tested it, but I suspect a simple, axiomic CSS file and simpler HTML file would produce faster rendering than Tailwind, and travel over the network faster.
Tailwind improves the developer experience at the expense of badly optimised code bloating and slowing the user experience. The developer experience benefits are debatable, too: I freaking hate using CSS toolkits and would much rather just write CSS or SASS bespoke to my apps. I have more control and can tailor a solution for the problem.
Re: Play with TailwindCSS in the Browser
#69Im sorry but I don’t understand how anyone can look at that and think it’s a good way to build UIs. I’m almost certainly in the wrong, considering how popular this library seems to be getting, but holy heck that looks like a tedious mess to work with. It’s like you have to learn every raw CSS selector, and then also learned how it’s represented in Tailwind, and then scatter that all over your markup.
Tailwind is a thin wrapper for the people scared of CSS. I use Tailwind at work, and it opened my mind to the benefits of an "ugly" html layout with inline styling. However, being there now, I think that inline CSS offers the better "Tailwind experience" - CSS requires no setup, and learning it properly is a good investment for the future when Tailwind, like so many other frameworks, will inevitably end up on the fro…
Re: Play with TailwindCSS in the Browser
#70Earlier quoted context omitted.
It pushes you to componentize common UI elements. Feel bad to have long utility classes that look like . Change it to: Submit using whatever tooling you prefer. If you don't use this style, maybe you won't like it. I've found it's a waste of time to extract classes for items that are not repeated. And putting utilities in components lightens your "master" CSS file and makes it a lot easier to work with CSS. I've foun…
That is called Class in CSS...
People that haven't used Tailwind come along and say, "this is silly, just use css". The people who have used it say, "you should try it, it's not what you think."
There are a bunch of subtle differences with Tailwind that make it quite a different experience.
Really, it's closer to inline-styles++ than anything else. The style only applies to the element you're styling. This is by design as it means you can change that one style without wondering what else you've broken across your app.
But you get variations that inline styles can't do (and aren't fun to do in css either): `text-green hover:text-red dark:hover:text-white` (interaction states, light/dark mode, responsive etc etc). This makes a huge difference when you're actually building this stuff.
Personally, from a DX point of view, I really like it. I find it faster than anything else when I'm building and it's easy to debug too; no need to fish for the styles, they're inline on the element I'm styling.
The biggest wart is the inability to functionally build up styles. For example, you have a bunch of js and you need to flip between several different colour states (say for an input that has "disabled | errored | valid | pristene"). There's no great way to force one of your classes to "win" because they're all just classes and the way they were added to the page will determine which border colour wins, for example.