Is it right to write this way in sass?

Is it so cost cascade? When collecting sass compileda in 1 file style.min.css

.callback{
 padding: 20px 0;
&__header{
 font-size: em(22);
 line-height: 30px;
 font-weight: 600;
 text-align: center;
}
&__subheader{
 font-size: 18px;
 font-weight: 400;
 line-height: 40px;
 color: $grey_color;
 text-align: center;

}
&-form{
 float: none;
 margin: 0 auto;
&__name{
 width: 100%;
}
}
}
July 8th 19 at 12:19
3 answers
July 8th 19 at 12:21
Solution
Yes. Almost.
Here you have two blocks (BEM-block)
.callback {}
.callback-form{}

Better to write to write them separately. And elements of the it rules.
Their should be two - one for block, another for the form. It is not going into the contents of the selectors. - rhianna_Yost commented on July 8th 19 at 12:24
July 8th 19 at 12:23
Yes, that's right.
July 8th 19 at 12:25
In the future these things &__header will turn into HELL, if your project grows to dozens of separate .scss sourcemap will not. Because finding the desired item will be unrealistic.
I do not agree, BEM taxis. - rhianna_Yost commented on July 8th 19 at 12:28
: BEM steers, but such nesting in Scss sucks. Read, for example: https://www.sitepoint.com/beware-selector-nesting-sass/ - rhianna_Yost commented on July 8th 19 at 12:31
: in this use is that nesting in css prntscr.com/bken0n - Weldon.Wolf commented on July 8th 19 at 12:34
: Yes, nesting will not, it is a BAM. read the Sass reference, specifically about the &operator. - Estrella.Johns commented on July 8th 19 at 12:37
I know that there will be nesting! Beat selector to pieces in scss wrong. You yourself read the article in my answer. - rhianna_Yost commented on July 8th 19 at 12:40
wrong - to write "not right." A beat selector to pieces or not - the choice of the developer based on the methodology used.
Sass functionality & operator himself hints at such an approach. In the BEM it is the only right approach. - Weldon.Wolf commented on July 8th 19 at 12:43
: about the article: it says that this naming cannot find the selector in your code. Yes, that's right. Itself with this problem every day. But the problem disappears if competently to organize the structure and use a real IDE instead of text editor.

vk.cc/5js7qP - Margot commented on July 8th 19 at 12:46
looked at the article, there is a compelling case in addition to any
I don't like
and "it seems to me that the code will become confusing." - Margot commented on July 8th 19 at 12:49
: There are only 3 levels of nesting, 3! Connect ArcMap never to be confused. - rhianna_Yost commented on July 8th 19 at 12:52
Call the file the Ian blocks. As they can not be found. - Rene.DAmore commented on July 8th 19 at 12:55
: and answer me why?
I quote the screenshot from his project illustrating the "structure + IDE". I have everything in order, is the author of the article (several comments above) is struggling to find the selector. - Rene.DAmore commented on July 8th 19 at 12:58
: Confused, not you)) I - Margot commented on July 8th 19 at 13:01
: Do not carry nonsense. No problem finding this approach causes. On the contrary, allows to obtain a more convenient structure. - Rene.DAmore commented on July 8th 19 at 13:04
>>no sourcemap
Why is it suddenly not be? No, if you own evil Pinocchio, then of course... - Tatum.Schinn commented on July 8th 19 at 13:07
>> Because finding the desired item would be unrealistic.
Do not you think that finding the right block search is enough (since you have no sarapov :) )
And in the block-the element will be found. - Lulu_Zulauf71 commented on July 8th 19 at 13:10
: Don't you think that unless you can work some more developers? How to understand the unreadable code? - Lulu_Zulauf71 commented on July 8th 19 at 13:13
And if there will be another developer? Or are you to write your code and call styleguide files and classes just for them? Do your code view! .article-page .article-category-page {&__inner > a {}} this is not a BAM! And disgusting code! - Weldon.Wolf commented on July 8th 19 at 13:16
For each block in the file?? You seem to think the block a whole page? Or divide the project into a million files, which are then collected for 10 minutes? - Weldon.Wolf commented on July 8th 19 at 13:19
this is now convenient. And if you open the project in a year, will for the mind to grasp. - Weldon.Wolf commented on July 8th 19 at 13:22
: Well, the founders of BAM is recommended not only blocks, but individual elements and modifiers in the file scatter. So the block on the file - it still rules :)
Personally, I lay the block that is on file. It happens in 200-300 files. Going galpon instantly.

Over several developers. Work. Normal read. Perhaps a matter of habit. I will not argue.

Styleguide for Bamu have long described the guys from Yandex. Why more time to write? - Weldon.Wolf commented on July 8th 19 at 13:25
: There are projects that I support for several years. Any difficulties do not. - Lulu_Zulauf71 commented on July 8th 19 at 13:28
: Gulp is good, really fast. But Grunt - very slow on many files. And for Bamu I don't like)).
I also used to be easier to beat all&__ & - -, but with the selectors, all the code looks cleaner and more readable. And on the broken selectors I did not miss :) - Tatum.Schinn commented on July 8th 19 at 13:31

Find more questions by tags SassLayoutCSS