Skip to content

Instantly share code, notes, and snippets.

@mirisuzanne
Created October 17, 2014 17:35
Show Gist options
  • Select an option

  • Save mirisuzanne/26aced3cc778345843b2 to your computer and use it in GitHub Desktop.

Select an option

Save mirisuzanne/26aced3cc778345843b2 to your computer and use it in GitHub Desktop.
Generated by SassMeister.com.
// ----
// Sass (v3.4.6)
// Compass (v1.0.1)
// ----
@function map-append($map, $key, $value) {
@return map-merge($map, ($key: append(map-get($map, $key) or (), $value)));
}
@function parse-expects($expects) {
$map: (
);
@each $item in $expects {
@if map-has-key($map, compare) {
$map: map-append($map, expect, $item);
} @else if map-has-key($map, test)
and type-of($item) == string
and str-index($item, 'to ') {
$map: map-append($map, compare, $item);
} @else {
$map: map-append($map, test, $item);
}
}
@return $map;
}
.test {
@each $key, $value in parse-expects(3 - 17 monkeys 'not to be' under the sky) {
#{$key}: $value;
}
}
.test {
test: -14 monkeys;
compare: "not to be";
expect: under the sky;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment