Sha256: 255edb5bc8b10221281f529f49630d53da8830c617f891950ca110ff86dab8c8

Contents?: true

Size: 1.52 KB

Versions: 7

Compression:

Stored size: 1.52 KB

Contents

// Accepts a gutter definition in the human-readable format. Converts it to the internal format,
// appends it to a list of gutter and returns the resulting list.
//
// Note that this function only returns a new list, it does not modify the source list.
//
// add-gutter($grid-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($gutter-definition, $append-to-list: $gutters) {
  $parsed: parse-add($gutter-definition); // Converts the definiton to a temporary format:
                                          // either `((<gutter>))` or `((<gutter>) (<breakpoint>))`
  $gutter:      nth($parsed, 1); // E. g. `(<gutter>)`.
  $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>)`
    @return $gutter;
  }
  @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 $breakpoint), 'comma');
  }
}

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
singularitygs-1.1.2 stylesheets/singularitygs/gutters/_add.scss
singularitygs-1.1.1 stylesheets/singularitygs/gutters/_add.scss
singularitygs-1.1.0 stylesheets/singularitygs/gutters/_add.scss
singularitygs-1.0.8 stylesheets/singularitygs/gutters/_add.scss
singularitygs-1.0.7 stylesheets/singularitygs/gutters/_add.scss
singularitygs-1.0.6 stylesheets/singularitygs/gutters/_add.scss
singularitygs-1.0.5 stylesheets/singularitygs/gutters/_add.scss