Skip to content

Instantly share code, notes, and snippets.

@KittyGiraudel
Created July 3, 2014 17:49
Show Gist options
  • Save KittyGiraudel/59eebf613a953839e282 to your computer and use it in GitHub Desktop.
Save KittyGiraudel/59eebf613a953839e282 to your computer and use it in GitHub Desktop.
Generated by SassMeister.com.
// ----
// Sass (v3.3.9)
// Compass (v1.0.0.alpha.20)
// ----
// Cast `$value` to a list using `$separator` as a separator.
//
// @param {*} $value - value to cast to list
// @param {String} $separator (list-separator($value)) - separator for the list
//
// @return {List} - $separator-separated list
@function list($value, $separator: list-separator($value)) {
@return join((), $value, $separator);
}
// Test mixin.
// Pass `$value` to `list()` function
// then output new list's parameters.
@mixin test-list($value, $separator: list-separator($value)) {
initial: $value;
$new-list: list($value, $separator);
list: $new-list;
type: type-of($new-list);
separator: list-separator($new-list);
length: length($new-list);
}
test-1 {
@include test-list("a" "b" "c", space);
}
test-2 {
@include test-list("a" "b" "c", comma);
}
test-3 {
@include test-list("a", space);
}
test-4 {
@include test-list("a", comma);
}
test-5 {
@include test-list(("a", "b", "c"), space);
}
test-6 {
@include test-list(("a", "b", "c"), comma);
}
test-1 {
initial: "a" "b" "c";
list: "a" "b" "c";
type: list;
separator: space;
length: 3;
}
test-2 {
initial: "a" "b" "c";
list: "a", "b", "c";
type: list;
separator: comma;
length: 3;
}
test-3 {
initial: "a";
list: "a";
type: list;
separator: space;
length: 1;
}
test-4 {
initial: "a";
list: "a";
type: list;
separator: comma;
length: 1;
}
test-5 {
initial: "a", "b", "c";
list: "a" "b" "c";
type: list;
separator: space;
length: 3;
}
test-6 {
initial: "a", "b", "c";
list: "a", "b", "c";
type: list;
separator: comma;
length: 3;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment