Nicolas Blaudez
Nicolas Blaudez

Reputation: 107

SASS @each and @for generate nothing

This code does not generate error but classes was not created.

Do someone have an idea ?

$properties: margin, padding, height, margin-top, margin-bottom, border, 
height;

@each $property in $properties {
  @for $size from 1 through 500 {
    .#{$property}-#{$size} {
      $property: #{$size}px;
    }
  }
}

Upvotes: 1

Views: 31

Answers (1)

Erik
Erik

Reputation: 156

You also need to interpolate the css-property: #{$property}: #{$size}px;

Upvotes: 4

Related Questions