การเชื่อมต่อส่วนต่างๆ ของซีเลกเตอร์ใน LESS

คุณสามารถเชื่อมต่อแม้แต่ส่วนต่างๆ ของคลาสเดียวกันได้ ตัวอย่างเช่นแบบนี้:

styles.less.button {
  &-ok {
    color: green;
  }
  &-cancel {
    color: red;
  }
}

ผลลัพธ์หลังจากคอมไพล์ เราจะได้โค้ดดังต่อไปนี้:

styles.css.button-ok {
  color: green;
}
.button-cancel {
  color: red;
}
Задание 1

ลดความซับซ้อนของโค้ดที่กำหนดให้:

styles.less.label-success {
  color: green;
}
.label-warning {
  color: yellow;
}
.label-error {
  color: red;
}