Alas, after several months we tore it all out and went back to React+Tailwind.
We still use native HTML popovers and :has selectors and other things we've have learned.
But writing UIs across three files (template, stimulus controllers, css) is such a tremendous bore. Concepts that belong together are spread out and I needed to be diligent with placing attributes and classes and remember to remove them all when removing functionality again. Obviously no compile-time checks, just magic strings and runtime errors. The Hotwire docs were also surprisingly hard to work with. All in all a lot of friction.
This just was not worth it.
inb4 rage, it is possible to use React for the UI alone and pass in fully formed view models, use form submissions and links.
But there is.
I think cascading is a bad default. It's useful, but only sometimes, and often causes headaches like unintended coupling and confusion about why rules are being overridden. The utility class approach (like Tailwind) makes a lot of issues like this go away. I don't see a good reason why the traditional approach is worth the extra pain or discipline.
The cascade model is a bad design.
In particular I use:
1. The `composes` feature to do something like base classes.
2. The import feature to get something like namespacing.
Given the recent advancements in CSS, I won’t be surprised if they eventually build something like `composes` into the base language.
The namespacing seems more like an artifact of how you package your website and how you stay organized within your package system (I use webpack).
> Using characters as the unit of measure ensures that we get the right behavior no matter which device you’re using and in a number of other scenarios such as multitasking on iPad or even if you simply enlarge the font size past a certain point.
Nice idea! I haven't seen this before.
A better comparison would use, for example, a React component:
function Button({ children }) {
return (
<button
className="inline-flex items-center gap-2 px-4 py-2 rounded-full
border border-gray-300 bg-white text-gray-900
hover:bg-gray-50 focus:ring-2 focus:ring-blue-500"
>
{children}
</button>
);
}
// Usage:
<Button>Save</Button>
This would counter all of the article’s arguments in favor of pure CSS. If the website used a `Button` component like this, it would also be true that the “HTML stays readable”, that “changes cascade”, that “variants compose”, and that “media queries live with components”.A better argument against Tailwind would be the added complexity of having a build system and a front-end framework or templating language, if your project doesn’t already have those for other reasons.
(adapted from my better-formatted comment at https://lobste.rs/c/oznzzj)