Skip to content

Instantly share code, notes, and snippets.

@pikesley
Created February 28, 2016 16:17
Show Gist options
  • Save pikesley/7e0d6a345f740740ba49 to your computer and use it in GitHub Desktop.
Save pikesley/7e0d6a345f740740ba49 to your computer and use it in GitHub Desktop.
I cannot SASS
tr.foo {
background-color: #fa5100;
}
tr.bar {
background-color: #0c58a2;
}
tr.foo {
background-color: $foo;
}
tr.bar {
background-color: $bar;
}
$foo: #fa5100;
$bar: #0c58a2;
$things: ('foo', 'bar');
@each $thing in $things {
tr.#{$thing} {
background-color: unquote("$#{$thing}");
}
}
@JeniT
Copy link

JeniT commented Feb 28, 2016

Try something like:

$things: (foo: #fa5100, bar: #0c58a2);

@each $thing, $colour in $things {
  tr.#{$thing} {
    background-color: #{$colour};
  }
}

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