Advertisement
Guest User

SASS @extend inheritance - Duplicated output

a guest
Apr 3rd, 2012
278
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Inheritance chain: Shape => Square => Circle
  2.  
  3. /* index.html =============== */
  4. <div class="square"></div>
  5. <div class="circle"></div>
  6.  
  7. /* style.scss =============== */
  8. @import "square";
  9. @import "circle";
  10.  
  11. /* _shape.scss ============== */
  12. .shape {
  13.   border: 10px solid silver;
  14. }
  15.  
  16. /* _square.scss ============== */
  17. @import "shape";
  18. .square {
  19.     @extend .shape;
  20.     width: 100px;
  21.     height: 100px;
  22. }
  23.  
  24. /* _circle.scss ============== */
  25. @import "square";
  26. .circle {
  27.     @extend .square;
  28.     @include border-radius(9999px);
  29. }
  30.  
  31. /* ||||||| OUTPUT |||||||||||| */
  32.  
  33. .shape, .square, .circle {
  34.   border: 10px solid silver;
  35. }
  36.  
  37. .square, .circle {
  38.   width: 100px;
  39.   height: 100px;
  40. }
  41.  
  42. .shape, .square, .circle {           <==== Repeated
  43.   border: 10px solid silver;         <==== Repeated
  44. }                                    <==== Repeated
  45.  
  46. .square, .circle {                   <==== Repeated
  47.   width: 100px;                      <==== Repeated
  48.   height: 100px;                     <==== Repeated
  49. }                                    <==== Repeated
  50.  
  51. .circle {
  52.   -webkit-border-radius: 9999px;
  53.      -moz-border-radius: 9999px;
  54.           border-radius: 9999px;
  55. }
  56.  
  57. /* ================================
  58. When I remove @import "square"; in style.scss, the repetition disappears but I want to be able to explicitly import "square" too, to see that I can use this class, and not just "circle", for clarity.
  59. What am I doing wrong here? Is it a known bug?
  60. =================================== */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement