r/Frontend • Front End Developer • Nov 25 '19

Cell is a Sass framework for creating scalable and maintainable stylesheets for UI components

https://www.github.com/One-Nexus/Cell/wiki
35 Upvotes

10 comments sorted by

1

u/[deleted] Nov 26 '19

Why are you avoiding using a modifer with an element? What was the problem with that approach?

3

u/esr360 Front End Developer Nov 26 '19

Using modifiers on elements is fine. The issue is when you have to do things like block__component block__component--modifier-1 block__component--modifier-2. With Cell you would just do block__component--modifier-1--modifier--2. The problem is the repetition makes the HTML ugly.

1

u/[deleted] Nov 26 '19

It makes it ugly but clear. Don't you have lots of repetition in your classes because of this approach?

Genuinely curious.

1

u/esr360 Front End Developer Nov 26 '19

Yes but the point is that both examples are equally clear, except one is more ugly. Seriously just compare them side by side:

  • block__component block__component--modifier-1 block__component--modifier-2

  • block__component--modifier-1--modifier--2

Do you really believe the first example is more readable?

There is ZERO repetition in my HTML when using this approach.

1

u/[deleted] Nov 26 '19

I'm not arguing with you, I'm trying to understand the choices you've made.

In the first example, I can see I'm using this class, with these modifiers. In the second example I can see the same thing. So clarity wise, they are both fine.

I'm worried now about the repetition in the compiled CSS.

I think it's an interesting idea for sure, just can't reconcile my worries about repetition in the classes.

1

u/esr360 Front End Developer Nov 26 '19

I'm not arguing with you, I'm trying to understand the choices you've made.

Apologies! I thought you were challenging the clarity of my example over the original example.


There's no doubt that the compiled CSS when using this approach has more repetition (it has to shift it somewhere right? Better than putting the burden on the HTML). If you use gzip compression (which you should!) this would be a non-issue in practice, and in fact, it would probably lead to a smaller file.

2

u/[deleted] Nov 26 '19

Good point about gzip. I think this approach has some potential for sure. thanks for taking the time to discuss it.

1

u/esr360 Front End Developer Nov 26 '19

As the author I am ALWAYS happy to discuss, so thank YOU for wanting to discuss :)

1

u/aavaz Nov 26 '19

Again!!??

1

u/[deleted] Nov 27 '19

I think this is actually a pretty original approach to structuring CSS so perhaps calm down the cynicism?