3 ms·
Honestly, what the hell are we talking about here? CSS is one thing and JS another. It's typically better to use CSS for styling because it's declarative and
by preommr 8y ago
Honestly, what the hell are we talking about here?
CSS is one thing and JS another.
It's typically better to use CSS for styling because it's declarative and simple. If your use cases are more complicated then use css preprocessors to resolve issues like variable names (something brought up in that twitter convo). If you want to do things at runtime then you need something procedural like js.
If you decide to forego css even for simple cases and use js because you think it'll be easier to maintain then obviously you'll need some tooling and conventions in place. If you have those, go for it.
If people want to put js in css (again, something brought up in the twitter thread), then that's fine too if various vendors supported it and there was a reason for it over js. There currently isn't, so again, I don't know what the hell we're talking about.
Also:
> The facebook codebase has thousands of !important statements, despite being written by competent engineers with solid engineering practices and deep relationships with design teams.
lol
- danabramov 8y ago> lol "I'd rather assume other people are incompetent than accept that maybe maintaining tens of thousands of components presents unique challenges that I could learn from."
- hombre_fatal 8y agoYou can click into any web-dev related discussion on HN to find someone trotting out their thinly-veiled assumption of "everyone is incompetent except for me". When I read the title of the submission, I immediately envisioned the typical "I thought we learned CSS belongs in its own file, why are web developers idiots?" comment. Everyone is always trying to unmask each other as incompetent because it spares them the effort of being open-minded, of resisting the tempting repulsion of new thoughts, and of understanding why someone might prefer something else.
- preommr 8y agolol because it's a meaningless statement not the least because it implies smart people always produce perfect code. I don't think it's ever a good idea to bring into question people's competency when discussing software design principles. It's hard to quantify, difficult to verify and not usually relevant. I am not assuming they're incompetent. I am disagreeing with the idea that their failure comes from just the technology and not in anyway from the actions of a developer. Whether it's because time constraints or just because shitty things happen like they do in any project regardless of how much money or how top tier the talent is.
- andrewmcwatters 8y ago> "I'd rather assume other people are incompetent than accept that maybe maintaining tens of thousands of components presents unique challenges that I could learn from." Entirely disingenuous, and doesn't assume good faith by communicating experience. > I am disagreeing with the idea that their failure comes from just the technology and not in anyway from the actions of a developer. Exactly. More often than not, in fact a majority of the time, people are flawed when it comes to UI development. This underscores how greatly we undervalue good engineering. It's not some thing that's just commonplace. As a barometer, not all of my coworkers are competent enough to build projects or products on their own that other engineers want to consume. In fact, especially when it comes to UI-related projects, almost none of them are competent enough to do so, and that's okay. But it means I extend this criticism outside of the workplace, where I've worked at several companies where people could hardly take Photoshop renders and accurately replicate them in HTML and CSS, nor did many of them have an appropriate grasp of the visual formatting model.
- tracker1 8y agocss in js does NOT put JS in css... there have been other efforts to do things like that. CSS in JS generates the styling from JS at a component level. This has advantages of centralized theme/style and configuration values at build/deploy/runtime over other CSS generation options, while being every bit as flexible. There are many libraries with varied approaches. styled-compenents and react-jss are probably the two most commonly used. Maybe learn a little about the subject at hand before spouting off and showing your own ignorance.
- preommr 8y ago1) I never said css in js puts js in css. I don't even know what this means. 2) You can still have component level css files without using some kind of framework that puts css into js. I've written projects where there was an implicit organization of components where css rules would target components by having more specific rules. Like I said, there are reasons to have css in js. If the project doesn't require it, there's an argument to be made for keeping things simple by not including js dependencies for styling. Especially because in those situations it's not difficult to refactor the css into js. > Maybe learn a little about the subject at hand before spouting off and showing your own ignorance. ironic
- tracker1 8y agoOkay... now add in the ability to have a Default color... add in the option for that color to be overriden for a given deployment. Now add in options to have a style setting configurable application wide in the application. Now add in the option to have a configuration option per-user. You can either create some rube-goldberg configuration/generation for the entire application with complexity at multiple layers... OR ...deepMerge some JSON to deliver and have the theme/components use that.