DEV Community

Discussion on: Style beautiful web pages without writing any CSS. Using W3.CSS.

Collapse
 
katsanos_george profile image
George Katsanos

"but every component lives for itself"
Please dont' forget that just because many people decide to do "one thing" it doesn't mean it's the ultimate truth. People thought Earth was flat, smoking was good, cocaine was a good medicine etc.
Repeating CSS in every component just because "some folks at Facebook" said it's good for you isn't really a technically convincing argument.
Sure, component based architecture is all fine, but repeating a bunch of CSS properties to every component's scoped CSS will eventually add CSS size, impact performance, and make redesigns harder.
"the syntax is horrible" => subjective opinion.
Redundancy is not repeating classes, because classes ARE MEANT TO BE REPEATED.
Parsing is not impacted. Document size doesn't matter - it's cached anyway.

Please speak with solid arguments and not just personal preference. This type of engineers is what's most annoying in the job.

Collapse
 
tomekbuszewski profile image
Tomek Buszewski • Edited

Hello George,

First off, this is a personal comment on a personal blog posting. It's meant to be subjective and I feel that I have justified my reasoning. This is no scientific debate that needs ten references for every sentence :)

I don't say that components are "the ultimate truth", but using such architecture for a long time (way before I started to use React or even Angular JS) has proven very performant. The key here is composition. If you compose your larger components (or, containers) with some smaller ones, you won't repeat your CSS. I don't think this is the place to discuss pros and cons of componetisation, given the fact that the article is about atomic CSS.

Plus, I still believe that using w3-btn w3-border w3-teal w3-margin w3-padding-large w3-left w3-large w3-opacity to style a simple button, an element that will be repeated multiple times, is redundancy. it will impact your document size and, even cached, it will have to be sent to the client.

Last, but not least, I don't believe that every decision needs only "technically convincing arguments". Sure, it's great to have those and take them under consideration. But if we would decide solely based on technicalities, we would all write using C or even low-level languages.

Now, please don't assume that I am against atomic architecture. I am not. If this suits one's needs – this is great.

Thread Thread
 
katsanos_george profile image
George Katsanos

We're engineers and our decisions should be based on engineering, not on number of blog posts / hype driven development.

Thread Thread
 
katsanos_george profile image
George Katsanos • Edited

Also I would like to point out words used in your original comment:
"atomic CSS was hip some time ago"
"the syntax is horrible"

you know what's horrible?

.header--login__buton { 
   display: block;
   padding: 10px 0;
}

.footer--menu__button {
   display: block;
   padding: 10px 0;
}

compare this with

<header>
  <a href="/whatever" class="block-button padding-s">button</a>
<header>
<footer>
  <a href="/whatever" class="block-button padding-s">button</a>
</footer>

Thread Thread
 
tomekbuszewski profile image
Tomek Buszewski

George, this is misunderstanding of BEM principles. Your code should look like this:

.link {
  display: block;
  padding: 10px 0;
}

...

.header__link {
  color: red;
}

---

<header class="header__container">
...
  <li><a href="#" class="link header__link">Hi</a></li>
...
<footer class="footer__container">
...
  <li><a href="#" class="link">Bye</a></li>

Plus, BEM syntax also isn't the prettiest one :)

Thread Thread
 
tomekbuszewski profile image
Tomek Buszewski

George, please don't exaggerate. Yes, our decisions should be based on knowledge, metrics, etc., but also on ease of development, entry and complexity levels, adoption etc. Those factors are extremely important. I know people that would even put those higher than sheer performance, simply because, when your code is really good, differences are a lot less significant than, for example, people quitting after three months because of the tech.

Thread Thread
 
katsanos_george profile image
George Katsanos

Atomic CSS is easier to use than juggling between nested selectors and having to write CSS classes like:
main__header--nav-home.
I think we analyzed enough. This is a technology blog and we should speak like professionals, not like fanboys

Thread Thread
 
jenc profile image
Jen Chan

chomps on popcorn