New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature for @each directive #1262

timfayz opened this Issue May 31, 2014 · 3 comments


None yet
3 participants

timfayz commented May 31, 2014

Example from documentation:

//vertical assignment
@each $animal, $color, $cursor in
    (puma, black, default),
    (sea-slug, blue, pointer),
    (egret, white, move) {

What about this?

//horizontal assignment
    $animal in (puma, sea-slug, egret),
    $color in (black, blue, white),
    $cursor in (default, pointer, move) {
//provided that all lists have the same length

To make that I need as follows:

$i: 1;
$animals: (puma, sea-slug, egret);
$colors: (black, blue, white);
$cursors: (default, pointer, move);
@while $i <= length($animals) {
  $animal: nth($animals, $i);
  $color: nth($colors, $i);
  $cursor: nth($cursors, $i);


  $i: $i + 1 !global;

What do you think?

@timfayz timfayz changed the title from New feature for @each directive to Feature for @each directive May 31, 2014


This comment has been minimized.


nex3 commented Jun 6, 2014

The proposed syntax reads very ambiguously. I'd expect it to be equivalent to the following:

@each $animal in (puma, sea-slug, egret) {
  @each $color in (black, blue, white) {
    @each $cursor in (default, pointer, move) {
      // ...

I don't think that level of ambiguity is worth the benefit.

@nex3 nex3 closed this Jun 6, 2014


This comment has been minimized.

lolmaus commented Jun 6, 2014

Having this feature implemented would allow coding custom mixins that do the described functionality.


This comment has been minimized.

timfayz commented Jun 7, 2014

The proposed syntax reads very ambiguously.

You know better how it looks like. Nonetheless thanks! :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment