Answer the question
In order to leave comments, you need to log in
How to inherit nesting in SCSS(SASS)?
Hello. Periodically there are such pieces of code:
.main-menu {
display: none;
position: absolute;
left: 0;
top: 50px;
background-color: #fff;
&--open {
display: block;
.main-menu__link {
}
}
}
.main-menu {
display: none;
position: absolute;
left: 0;
top: 50px;
background-color: #fff;
&--open {
display: block;
&__link{} // и что бы получалось в итоге селектор main-menu__link а не main-menu--open__link
}
}
Answer the question
In order to leave comments, you need to log in
.main-menu {
$this: &;
display: none;
&--open {
display: block;
#{$this}__link { }
}
}
.main-menu {
display: none;
&--open { display: block; }
&--open &__link { }
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question