Skip to content

Instantly share code, notes, and snippets.

@lunelson
Forked from anonymous/SassMeister-input.scss
Created March 17, 2016 07:26
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save lunelson/db71097b2185f8827129 to your computer and use it in GitHub Desktop.
String interpolation bug, libsass 3.3.3
// ----
// libsass (v3.3.2)
// ----
@function slice($list, $start: 1, $end: length($list), $sep: list-separator($list)) {
$output: ();
@if $start >= 1 and $end >= $start {
@for $i from $start through $end {
$output: append($output, nth($list, $i), $sep);
}
}
@return $output;
}
@function power-set($list) {
$result: ((),);
@for $i from 1 through length($list) {
@for $j from 1 through length($result) {
$result: append($result, (join(nth($result, $j), nth($list, $i))));
}
}
@return slice($result,2);
}
@function to-string($list, $glue: '') {
$result: '';
$length: length($list);
@for $n from 1 through $length {
$result: $result + nth($list, $n) + if($n == $length,'',$glue);
}
@return quote($result);
}
@each $set in power-set(a b c d) {
.wrap--#{to-string($set, '-')} {
debug: 'hello';
}
}
.wrap--a {
debug: 'hello';
}
.wrap--b {
debug: 'hello';
}
.wrap--a-b {
debug: 'hello';
}
.wrap--c {
debug: 'hello';
}
.wrap--a-c {
debug: 'hello';
}
.wrap--b-c {
debug: 'hello';
}
.wrap--a-b-c {
debug: 'hello';
}
.wrap--d {
debug: 'hello';
}
.wrap--a-d {
debug: 'hello';
}
.wrap--b-d {
debug: 'hello';
}
.wrap--a-b-d {
debug: 'hello';
}
.wrap--c-d {
debug: 'hello';
}
.wrap--a-c-d {
debug: 'hello';
}
.wrap--b-c-d {
debug: 'hello';
}
.wrap--a-b-c-d {
debug: 'hello';
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment