4 ms·
After trying out Tailwind in one pet project I have to say that for larger teams it should not be used. Looking at the code now I get the feeling that maintenan
by serpix 4y ago
After trying out Tailwind in one pet project I have to say that for larger teams it should not be used. Looking at the code now I get the feeling that maintenance would be a big problem.
A bigger project with multiple pages having full on Tailwind css classes peppered everywhere looks to be a nightmare.
Does anyone have experience jumping into an existing larger project with legacy tailwind all over the place? Would you do it again?
- ryanbrunner 4y agoI think the key with Tailwind is that you need to aggressively componentize for it to be useful. If your pages are 90% made up of small components than it can be very reasonable and pleasant to work with. If you have a lot of pages that define their own HTML it can turn into a mess very quickly.
- 12tvende 4y agoI dont see a problem with big teams at all. You opne up the components HTML and see the styling right there, no doubts in your mind where to edit the styling (no stylesheets to find etc.). Of course, this requires the team to have disciplin and make proper components so their not copy pasting tailwind classes 100 times
- Vinnl 4y agoI have only used Tailwind on personal projects, but I can't imagine it'd be harder than "regular" CSS, which is generally somewhat append-only anyway (you need a lot of team discipline to tame that somewhat). In fact, I'd expect it to be more maintainable, exactly because it removes the indirection of CSS classes. They're an abstraction that don't make much sense if you're already using components, and the very point of that abstraction -being able to reuse styles- is the very reason it quickly becomes append-only. With Tailwind, you can safely delete styles, knowing it won't affect styles elsewhere in your project.
- robby_w_g 4y agoThis succinctly nails what I love about Tailwind. It gets rid of the cognitive load of reviewing a css change and having to think through how the change will ripple throughout the site.
- eurasiantiger 4y agoIf only there was a DOM-aware CSS linter.
- alayek 4y agoI've had some experience migrating large UI projects at work to use a design system based on Tailwind. Haven't faced any issue with Tailwind at all, even while integrating in existing projects. Tailwind is a different way of writing CSS, with some guard-rails coming in from the design system consistency. Tailwind also provides sane defaults (rem over px, for instance). If someone's bad at writing or thinking in CSS, chances are, they'd be bad at Tailwind too. I've found Tailwind helps me focus on writing the CSS that matters. But just having Tailwind CSS in a project won't automagically fill one's gap in CSS knowledge. This isn't bootstrap, where one can use some col-* utilities and magically get a grid layout that just works across browsers. Tailwind is a bit lower level, and to achieve similar responsive layout, you still have to know how to do that with CSS grid, what the breakpoints are etc. Where Tailwind aids here, is by providing utility classes that help with original CSS grid intuition. For instance, `grid-cols-2 sm:grid-cols-4 md:grid-cols-6` would be hard to achieve by hand, writing vanilla CSS or styled-components. > A bigger project with multiple pages having full on Tailwind css classes peppered everywhere looks to be a nightmare. Ideally, you would be using a framework to help organize code better. Most likely React or Vue or something similar. In which case, you'd already have components. There are more than one way to achieve same look and feel, with CSS. Similarly, one can apply some discipline with using Tailwind's utility classes, when building anything. Two heuristics that have worked for me, are: - Never use margin if you can, use flex-box and grid with gaps instead. Placing a children node is parent's responsibility. - Write symmetric CSS. Prefer px over pl or pr, mx over ml or mr etc. Using margins make it hard to extract some React markup as a reusable component. Using symmetric CSS gives you automatic RTL compliance without using any of the CSS logical properties. Sure, there'd be times when a UI design cannot be implemented without breaking some of these. But in most cases I've encountered at work, building consistent UIs, have been easy for me and my team following these. Happy to go into details with code examples, if anyone's interested.
- yurishimo 4y agoThe symmetric bit is a good idea. I recently joined a team that maintains a multilingual LTR/RTL site so I'm learning some of these lessons the hard way. Padding > Margin can also be a good idea, even if working vertically. Padding cannot collapse which is usually what you want. Obv, ymmv.