Sha256: 844dddb4782304b85996180f65547c905a79577951ced96fb9700514ca1f2274

Contents?: true

Size: 1.59 KB

Versions: 3

Compression:

Stored size: 1.59 KB

Contents

// 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 : <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 `((<gutter-style>))` or `((<gutter-style>) (<breakpoint>))`
  $gutter-style:      nth($parsed, 1); // E. g. `(<gutter-style>)`.
  $breakpoint:        nth($parsed, 2); // Either `(<breakpoint>)` 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. `(<gutter-style>)`
    @return $gutter-style;
  }
  @else {
    // Appends to a comma-separated list of definitions in the internal format
    // and returns it, e. g. `(<gutter>), (<gutter> <breakpoint>), (<gutter> <breakpoint>)`
    @return append($append-to-list, ($gutter-style $breakpoint), 'comma');
  }
}

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
singularitygs-1.1.2 stylesheets/singularitygs/gutter-styles/_add.scss
singularitygs-1.1.1 stylesheets/singularitygs/gutter-styles/_add.scss
singularitygs-1.1.0 stylesheets/singularitygs/gutter-styles/_add.scss