Nối các phần của selector trong SASS
Bạn thậm chí có thể nối các phần của một lớp. Ví dụ, như thế này:
styles.scss.button {
&-ok {
color: green;
}
&-cancel {
color: red;
}
}
Kết quả sau khi biên dịch, chúng ta sẽ có mã như sau:
styles.css.button-ok {
color: green;
}
.button-cancel {
color: red;
}
Задание 1
Hãy đơn giản hóa đoạn mã dưới đây:
styles.scss.label-success {
color: green;
}
.label-warning {
color: yellow;
}
.label-error {
color: red;
}