extend-selector.less 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  1. .error {
  2. border: 1px #f00;
  3. background: #fdd;
  4. }
  5. .error.intrusion {
  6. font-size: 1.3em;
  7. font-weight: bold;
  8. }
  9. .intrusion .error {
  10. display: none;
  11. }
  12. .badError:extend(.error all) {
  13. border-width: 3px;
  14. }
  15. .foo .bar, .foo .baz {
  16. display: none;
  17. }
  18. .ext1 .ext2
  19. :extend(.foo all) {
  20. }
  21. .ext3:extend(.foo all),
  22. .ext4:extend(.foo all) {
  23. }
  24. div.ext5,
  25. .ext6 > .ext5 {
  26. width: 100px;
  27. }
  28. .should-not-exist-in-output,
  29. .ext7:extend(.ext5 all) {
  30. }
  31. .ext {
  32. test: 1;
  33. }
  34. // same as
  35. // .a .c:extend(.ext all)
  36. // .b .c:extend(.ext all)
  37. // .a .c .d
  38. // .b .c .d
  39. .a, .b {
  40. test: 2;
  41. .c:extend(.ext all) {
  42. test: 3;
  43. .d {
  44. test: 4;
  45. }
  46. }
  47. }
  48. .replace.replace,
  49. .c.replace + .replace {
  50. .replace,
  51. .c {
  52. prop: copy-paste-replace;
  53. }
  54. }
  55. .rep_ace:extend(.replace all) {}
  56. .attributes {
  57. [data="test"] {
  58. extend: attributes;
  59. }
  60. .attribute-test {
  61. &:extend([data="test"] all);
  62. }
  63. [data] {
  64. extend: attributes2;
  65. }
  66. .attribute-test2 {
  67. &:extend([data] all); //you could argue it should match [data="test"]... not for now though...
  68. }
  69. @attr-data: "test3";
  70. [data=@{attr-data}] {
  71. extend: attributes2;
  72. }
  73. .attribute-test {
  74. &:extend([data="test3"] all);
  75. }
  76. }
  77. .header {
  78. .header-nav {
  79. background: red;
  80. &:before {
  81. background: blue;
  82. }
  83. }
  84. }
  85. .footer {
  86. .footer-nav {
  87. &:extend( .header .header-nav all );
  88. }
  89. }
  90. .issue-2586-bordered {
  91. border: solid 1px black;
  92. }
  93. .issue-2586-somepage {
  94. .content:extend(.issue-2586-bordered) {
  95. &>span {
  96. margin-bottom: 10px;
  97. }
  98. }
  99. }