autofires
Writing CSS in Fresh
Sometimes improving processes requires learning up front for a longer term payoff (see Typescript).
But Tailwind is very basic compared to something like Typescript (but no less valuable in Web). If you have a CSS background once you see the mapping patterns you’ll rarely need the docs. I reference them mainly to teach me CSS features (picking up the listed Native CSS as a side effect).
In my experience far more effort was wasted fixing issues and learning patterns & strategies to mitigate the maintenance nightmare that is CSS at scale (BEM etc).
JSX elements that have a lot of TW classes are trivially easy to understand and maintain, if not it’s a sign the component is doing too many things.
Large sites take a long time to pivot and Tailwind is relatively new (most Websites are still PHP!).
Just try it see if it clicks. It does for everyone I teach (experienced Web Dev or not).
10 replies
Writing CSS in Fresh
Honestly you should really give Tailwind another chance. From what I read most people hate the idea of it, then use it and can’t live without it.
React/Preact is modelled around the “Separation of Concerns” model where “Component” is that separation area.
You already co-locate structure and behaviour in a component, excluding styles from this encapsulation is just going to lead to more long-term friction.
And Tailwind is one of the best solutions for co-locating styles right within structure.
10 replies
Partial with Forms
Are there any non-island reliant patterns for demonstrating a post is ongoing to the user?
As it’s a background action there’s no obvious browser loading behaviours so it can be a bit confusing to users.
Apparently hx-indicator is how this problem is handled in HTMX
https://htmx.org/attributes/hx-indicator/
15 replies
Partial with Forms
I don’t think it’s mentioned in the docs (yet), but make sure your partial route for the form POST also has a GET handler redirecting back to original page or you’ll get odd behaviours (in dev anyway). The partial form post url isn’t “hidden” in the same way as it is with partial nav on anchor tags.
Possibly just an issue during dev watch mode when a change will kick off a reload of the partial url as a page.
15 replies