csstools / postcss-advanced-variables

Use Sass-like variables, conditionals, and iterators in CSS
Creative Commons Zero v1.0 Universal
130 stars 33 forks source link

@each don't work properly. #88

Open Dragod opened 3 years ago

Dragod commented 3 years ago

I have @each loop:

@each $status $color in $list-statuses

but doesn't work

The doc only cover :

@each $animal $i in (puma, sea-slug, egret, salamander) {
    .#{$animal}-icon {
      background-image: url("images/icon-#{$i}.svg");
    }
  }

where $i is only a counter.

Is it not possible to do this:

@each $animal $i in (puma, sea-slug, egret, salamander), (something, something1, something2, something3) {
    .#{$animal}-icon {
      background-image: url("images/icon-#{$i}.svg");
    }
  }

or

$list-statuses: (
    "inprogress"    : $cv-pending,
    "In Progress"   : $cv-pending,
    "tobedone"  : $cv-g-200,
    "complete"  : $cv-success,
    "Complete"  : $cv-success,
    "Cancelled"     : $cv-alert,
    "Active"        : $cv-notification,
);

@each  $status $color in $list-statuses {
    [data-value="#{$status}"] {
        .list-dropdown {
            @include background-contrast-hover($color);
            border-color:$color;
        }

        &.cs-tag {
            @include background-contrast($color);
            border-color:$color;
        }
    }
}
t0byman commented 2 years ago

I have the same problem