News for hackers. Stuff that matters.
Re:Reimagine Atomic CSS by jdefelice on Wednesday November 17, 2021 @01:10PM (#29256594)
Your approach wouldn’t work with media queries. In a system like tailwind you can do class=“m-0 md:m-4”
Re:Reimagine Atomic CSS by cxr on Wednesday November 17, 2021 @01:14PM (#29256655)
If you're going to use something like Tailwind, please still add legible class names (e.g. "thumbnail") and don't just write things like class="m-0 md:m-4".
Re:Reimagine Atomic CSS by jdefelice on Wednesday November 17, 2021 @02:19PM (#29257607)
One could argue that `class="m-0 md:m-4"` is more legible because it describes exactly what is happening. No margin on small screen, margin of 4 units on medium breakpoints. Where the styling on thumbnail is unknown and the breakpoints are unknown, unless you look at the css, then if you need to override that css you have to worry about specificity.
Re:Reimagine Atomic CSS by cxr on Wednesday November 17, 2021 @03:51PM (#29258662)
You're talking about CSS. I'm talking about classes.

> `class="m-0 md:m-4"` is more legible because it describes exactly what is happening

If by "what is happening" you mean "how it's styled", but that's extremely presumptuous. You might as well argue that there's no difference between Flash and an equivalently styled web page since if you took a screenshot of each they'd be visually identical—as if the whole thing begins and ends with getting the "rectangle full of little lights" to change in a particular way <https://xkcd.com/722/>. It's very narrowminded.

I'm not saying you have to be full on schema.org-conformant, but include something that actually makes sense instead of being as useless as the spew that CSS compilers put out.

Re:Reimagine Atomic CSS by thisjeremiah on Thursday November 18, 2021 @10:50AM (#29266785)
I think the recommended pattern is something like:

If you’re using a component based framework (e.g., Vue), you create a named component.

If you’re not using a component-based framework, you create named classes with applied atomic styles.

With either approach, your styles are contextualized with a name and can be reused.

https://tailwindcss.com/docs/extracting-components

Re:Reimagine Atomic CSS by yakshaving_jgt on Wednesday November 17, 2021 @01:27PM (#29256859)
But then again, if you're going to use meaningful class names, i.e., names that suggest what the thing is rather than what it looks like, then you're not really doing the Tailwind thing.
Re:Reimagine Atomic CSS by cxr on Wednesday November 17, 2021 @03:56PM (#29258712)
> rather than

You don't have to sacrifice semantics in order to opt in to Tailwind's cutesy approach at expressivity. class="thumbnail m-0 md:m-4" works wherever class="m-0 md:m-4" does and isn't user-hostile.