U
U
urajo2021-06-28 12:01:27
css
urajo, 2021-06-28 12:01:27

Why nesting in scss if there is BEM?

In all courses, they often teach you to use a large number of selectors to a minimum, BEM gives you the opportunity to make a block_element and handle it that way, that is, in fact, use 1 class.
But when using scss nesting, a long selector is formed. How is it better then? Use bam or scss

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexey Ukolov, 2021-06-28
@urajo

Nesting in SASS just makes it convenient to make BEM selectors:

.block {
  foo: bar;

  &_element {
    bar: baz;
  }
}

But when using scss nesting, a long selector is formed
The very fact of using SASS does not affect the complexity of the selectors in any way. The result depends on the source code, not the compilation tool.
Yes, SASS allows you to screw up selectors if you're not careful and write thoughtlessly, but it doesn't force you to .

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question