R
R
Raym0NT2022-01-05 17:10:12
Layout
Raym0NT, 2022-01-05 17:10:12

Is this approach to layout with SCSS for BEM normal?

Good afternoon, is it normal to divide scss into separate blocks, as in BEM, and write media queries for each block, after loading all this into one css file?
And also is there any restriction in the use of media? Main scss file
61d5a5843b076125218022.png
block Is this file structure normal at all?
61d5a5c8ad184295177166.png
61d5a66829282646620497.png

Answer the question

In order to leave comments, you need to log in

2 answer(s)
S
Sergey delphinpro, 2022-01-05
@Raym0NT

That's what they do. Only media blocks are placed inside the selector.

.hero {
  &__title {}

  @media (min-width: 1000px) {
    color: red;
    &__title {}
  }
}

Some even set up a linter that ensures that there is only one root selector per file.

L
Lev Aleksandrov, 2022-01-27
@h3ckphy

I used to do this, then I got tired of creating a file every time, moving from one to another and creating a file for each tiny block. All this slowed down the work. Now again I write everything in one scss file.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question