News for hackers. Stuff that matters.
Re:In defense of functional CSS by darekkay on Thursday September 27, 2018 @09:59AM (#18084522)
> Because then every time you want to tweak all buttons on the site, you tweak it in one place.

What do you do, when the button markup changes? Let's say you need to make all links open in a new window? Then you still need to change 100 buttons. It's even more common for bigger components, like the ProfileCard example. What if the markup of your ProfileCard changes?

Instead of using CSS to define your components, I suggest using some real reusable components, either using templates or JS frameworks (depending on your use case).

Re:In defense of functional CSS by beaconstudios on Thursday September 27, 2018 @11:33AM (#18085453)
> What do you do, when the button markup changes?

hopefully you'd have a Button component in your preferred UI framework, and you'd change it once there.

Re:In defense of functional CSS by darekkay on Thursday September 27, 2018 @12:02PM (#18085744)
Exactly. The same applies to CSS when using the functional CSS approach. It's basically: if anything changes, I need to update my Button component.
Re:In defense of functional CSS by andrewingram on Thursday September 27, 2018 @12:15PM (#18085871)
Right. With the surge in popularity of components architectures, the maintainability concerns of inline styling methods are much less applicable. Perhaps there are other legitimate problems, but this one should be put to bed.
Re:In defense of functional CSS by yakshaving_jgt on Thursday September 27, 2018 @10:49AM (#18085030)
Open up Vim, and do a global find and replace with a simple regex. That's 100 or even 10,000 button changes in a minute.

That's not really related to "functional CSS" though.

Re:In defense of functional CSS by darekkay on Thursday September 27, 2018 @11:13AM (#18085261)
Your simple regex will take you 1-2 additional minutes to deal with prettified code like this:

  <button
    href=".."
    class="...."
  >Button</button>
And when you start fixing more complex components and HTML edge cases, you will have a lot of fun [0]. This is fine for legacy code. But I don't want to deal with this in modern projects, if I can just change a single file and be sure all components are updated. As you said, this is not related to functional CSS, but it solves many disvantages of it.

[0] https://stackoverflow.com/questions/1732348/regex-match-open...