// Accepts a gutter style definition in the human-readable format. Converts it to the internal format, // appends it to a list of gutter styles and returns the resulting list. // // Note that this function only returns a new list, it does not modify the source list. // // add-gutter-style($gutter-style-definition, $append-to-list) // - $gutter-definition : See documentation for syntax: // https://github.com/Team-Sass/Singularity/wiki/Creating-Grids // - $append-to-list : [list] A list to append to. // Defaults to $gutters if none is specified. @function add-gutter-style($gutter-style-definition, $append-to-list: $gutter-styles) { $parsed: parse-add($gutter-style-definition); // Converts the definition to a temporary format: // either `(())` or `(() ())` $gutter-style: nth($parsed, 1); // E. g. `()`. $breakpoint: nth($parsed, 2); // Either `()` or false. $list-length: length($append-to-list); // Check whether the definition will be the first one in the list // and whether it has no breakpoint specified. @if $breakpoint == false and $list-length == 0 { // Returns the first item of the list, e. g. `()` @return $gutter-style; } @else { // Appends to a comma-separated list of definitions in the internal format // and returns it, e. g. `(), ( ), ( )` @return append($append-to-list, ($gutter-style $breakpoint), 'comma'); } }