SASS에서 선택자 부분 연결하기
심지어 하나의 클래스의 부분들도 연결할 수 있습니다. 예를 들어, 다음과 같이:
.button {
&-ok {
color: green;
}
&-cancel {
color: red;
}
}
컴파일 결과 우리는 다음과 같은 코드를 얻게 됩니다:
.button-ok {
color: green;
}
.button-cancel {
color: red;
}
다음 코드를 단순화하세요:
.label-success {
color: green;
}
.label-warning {
color: yellow;
}
.label-error {
color: red;
}