Genuine question: does anyone know what CSS tool might be generating markup like this? A curious mixture of generated classes and inline styles.

35 replies
@zachleat My eyes! 😭
@mahryekuh haha forgot the CW sorry
@zachleat Boosting it so others can suffer through it too. Call it early Halloween. 😈🎃
@zachleat just about every frontend framework that does scoped styling 🙈
@konnorrogers @zachleat which? i mostly work with react (using CSS modules) and svelte, and neither of those will generate inline styles unless you explicitly set style attributes. AFAIK that’s pretty normal, so i’m also curious where that markup came from!
@jakelazaroff @konnorrogers it’s from bluesky
@zachleat @jakelazaroff IIRC Bluesky is React Native
@konnorrogers @jakelazaroff https://reactnative.dev/docs/stylesheet seems to match up
@zachleat @konnorrogers i think bluesky uses react-native-web to share their UI code between mobile platforms and the web, but none of the examples that i can find on https://necolas.github.io/react-native-web/ generate inline styles so i'd guess they're doing something weird. definitely a dark corner of the JS framework world!
@zachleat @jakelazaroff @konnorrogers
A mixture of generated classes and inline styles? OMFG, I'm so not surprised it's on Bluesky. #webdevgoals #webdevwtf #webdevfail #ReactNative
@zachleat I think I might have an idea. Are there any hints to what the backend tech is?
I’ve seen this technique used on the #dotnet side of things with Blazor, where each component is given a class as an identifier so that downstream components can be targeted when the UI is mutated.
The inline CSS could be additional scoped styles for changes from the defaults.
This is a guess based on the screenshot.
@khalidabuhakmeh @zachleat I agree at first the ids look similar, but Blazor uses usually one at a time and puts them as html attributes, not classes.
@zachleat Could be Tailwind/Windi/Uno/etc. They determine which classes to build by scanning the source code. For styles that are dynamic *and* not from a set known in advance, you have to use some other solution - like inline `style`.
Can imagine that forcing the `style="background-color:…"`.
Harder to see it forcing `style="flex-direction… gap… padding"` (sounds like known variant, typically pseudocoded `class={condition ? 'flex-direction-… gap-… padding-…')}` - cf https://tailwindcss.com/docs/content-configuration#dynamic-class-names)
@zachleat The class structure kind of looks like the output of Emotion? https://emotion.sh/docs/introduction
But I think even that library wouldn’t normally use inline styles, may be a dev decision or it’s like a component library also in play 😬
Looks like it’s React Native’s StyleSheet: https://reactnative.dev/docs/stylesheet
(thank you @konnorrogers @jakelazaroff 🙌🏻)
-
-
@zachleat yuck
-