Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Website: Is "Get the same benefits as BEM" accurate? #6371

Open
henrik opened this issue May 4, 2018 · 2 comments
Open

Website: Is "Get the same benefits as BEM" accurate? #6371

henrik opened this issue May 4, 2018 · 2 comments

Comments

@henrik
Copy link

henrik commented May 4, 2018

I've seen #3671, but feel this is a very separate question.

https://semantic-ui.com/ says "Get the same benefits as BEM or SMACSS, but without the tedium."

From a quick look, though, it seems to run counter to BEM. I'm not saying that's bad, just wondering if I'm missing something, or if that text could maybe be clarified.

My understanding of BEM is that it wants to minimise CSS specificity conflicts by using single classes rather than complex selectors (.foo__bar instead of .foo .bar or .foo.bar), and to make hierarchies very clear with explicit (though arguably tedious and technical) naming – in my previous example, you know that the "bar" is a subpart of a "foo".

From a brief look at the start page of Semantic UI, it makes very different trade-offs. Which, again, is fine – I'm just curious if I'm missing something and Semantic UI in fact does get those same benefits as BEM, in addition to its natural language style syntax.

@y0hami
Copy link
Member

y0hami commented May 4, 2018

I think what @jlukic means is that when you write semantic classes you can easily see how elements are getting styled via its natural language and the structure of the component.

e.g.

BEM:

.image {}
.image--large {}

SUI:

.ui.large.image {}

With SUI there is a few constant modifier classes used throughout the framework like small, .large, .center, right etc. Theses are your modifier classes.

There is also the block classes which are the main class for each component like .button, .grid, .dropdown etc.

In some cases you also have element classes like the dropdown component .dropdown is your block and then inside that you have .text which is the placeholder, .menu which is then a list of dropdown items these are both elements of the .dropdown block.

As you can see semantics classes build up very similar to the likes of BEM

I hope this clears up any questions you may have.

@henrik
Copy link
Author

henrik commented May 4, 2018

@hammy2899 Thank you very much! Appreciate it. That clears it up a bit.

I'm curious about how this compares to something like BEM as a project grows in complexity. In my experience, BEM solves some problems I've felt from previous ways of (not) structuring CSS, including avoiding specificity wars and being clear about which classes go together as one component. Are those pain points with SUI in a complex project, or does SUI help avoid those issues?

This is quite possibly beyond the scope of a GitHub issue – please feel free to close it if so :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants