56 points · by mzrnsh · 4y ago · 31 comments
But I also love styling them with a bit modern approach: Tailwind CSS.
So I posted a guide on how to make those two work together.
I suddenly feel very, very old.
So, time to go to hell for saying all of that.
the managers see how simple it is to build complex UIs in Tailwind and then project it into how much resources they can save their company and how quickly they'll be able to iterate on design
a major problem with projects that are built with tailwind is that the code produced is unmaintainable, unreadable spaghetti
you can even see it on their own home page if you scroll down a couple sections
tailwind also requires a build system and introduces 500+ npm dependencies, which is a huge security risk
personally i think Tailwind is a solution looking for problem and would avoid it at all costs
In my experience, Tailwind adoption is pushed hard by engineers who use it on side projects and see how delightful it is to use.
And if you think it's unmaintainable, maybe you should explain why you feel that way (apart from your clear distaste for it). My counterpoint is that it's amazing to be able to pick up a project after months or years and instantly understand what's going on.
I didn't get it at first either but I think perhaps a surprisingly big part of it is the fact that our UI is based on React and having everything contained within each component so you don't have to go hoping around between files is much nicer. And then it's just a thorough, tasteful and well thought out framework based on modern principles.
Compile time != run time. Those dependencies will never get to any form of production code.
Any reused styles (eg button) should be turned into a class via composition.
So it's flexible, but also ensures adherence to your company design standards.
I would say go bang-bang with all the classes for Marketing/Landing Pages and websites that will change regularly both in code and final designs.
Now, for a user logged in WebApp where many engineers (front + back) will work but want to leverage TailwindCSS without having to write everything from scratch, leverage its capabilities, but start writing your classes -- use TailwindCSS as a utility.
TailwindCSS makes it easy to get in new members to the team, and even new developers, just like Bootstrap does. It gives you the advantage of using it as your tamed tooling, complete with sharable design tokens between designers, the front-end, and the back-end.
You could have 10 classes or raw styles repeated 50 times and all instances of those might condense down to 1 string of WWUElinMSS1J1TQwMFFISi7KtsMiZAuVKU.
I think Tailwind is a great way to get a good looking site very fast, but I’d rather use eg a Toggle component that someone else built and tested than create my own and inevitably make some kind of accessibility mistake.
I do this because I hate dealing with the opaqueness of UI components. Every one has its own completely different API, every one imposes unnecessary constraints, and styling them requires you to submit to whatever styling method the library author thinks is best. I just want to have direct control over the DOM dammit! without having some busybody middleman library getting in the way.
This approach makes it very easy to, for example, have a menu button and its menu in completely different parts of the tree, making styling effortless. The helper class handles focus management, so the exact HTML isn't important, as long as the correct attributes are present.
https://shuffle.dev/blog/2022/01/plain-ui-simple-template-fo...
Does its job, gets out of my and helpful docs as well.
Horrible experience.
But isn't this a bit outdated now? I think it still uses Tailwind CSS 2.
The idea is that Jekyll is Ruby while the way Tailwind is setup (usually) is easier managed by the available NPMs. This kit makes it easy to marry the two.
I like it as this is simpler than the others I had seen, nothing more than the bare needed to get the work done.