Sha256: 77a5c60ac4cc4b33bb805bb15d7dc39aeea8010cb3673ed65f1c6a29501aafad

Contents?: true

Size: 2 KB

Versions: 15

Compression:

Stored size: 2 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($Gutter-definition, $append-to-list)
// - $gutter-definition : <definition>  See documentation for syntax:
//                                      https://github.com/Team-Sass/Singularity/wiki/Creating-Gutters
// - $append-to-list    : [list]        A list to append to.
//                                      Defaults to $gutters if none is specified.
@function add-gutter($gutter-definition, $custom-map: false) {
  $Parsed:      parse-add($gutter-definition); // Parses Gutter definition to Gutter/breakpoint
  $Gutter:        nth($Parsed, 1); // E. g. `(<Gutter>)`.
  $Breakpoint:  nth($Parsed, 2); // Either `(<breakpoint>)` or false.
  $Mobile-First: sgs-get('mobile first');
  $Gutter-Map: ();

  // Determine if a custom map or the default maps should be used.
  @if $custom-map {
    $Gutter-Map: $custom-map;
  }
  @else {
    @if sgs-has('gutters') {
      $Gutter-Map: sgs-get('gutters');
    }
  }
  $Gutter-Key-Length: length(map-keys($Gutter-Map));

  // Check whether the definition will be the first one in the list
  // and whether it has no breakpoint specified.
  @if $Breakpoint == null {
    // Returns the first item of the list, e. g. `(<Gutter>)`
    $Gutter-Map: map-merge($Gutter-Map, (-1px: $Gutter));
  }
  // IF the list is initiated with a list of Gutter columns need to start off
  // a comma seprated list.
  @else {
    @if not (map-has-key($Gutter-Map, -1px)) {
      $Gutter-Map: map-merge($Gutter-Map, map-get($Singularity-Settings, 'gutters'));
    }
    $Gutter-Map: map-merge($Gutter-Map, ($Breakpoint: $Gutter));
  }

  $Gutter-Map: sort-map($Gutter-Map, not $Mobile-First);

  @return $Gutter-Map;
}

@mixin add-gutter($gutter-definition) {
  $Add-Gutter: add-gutter($gutter-definition);
  $HOLDER: sgs-set('gutters', $Add-Gutter);
}

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
singularitygs-1.8.0 stylesheets/singularitygs/gutters/_add.scss
singularitygs-1.7.1 stylesheets/singularitygs/gutters/_add.scss
singularitygs-1.7.0 stylesheets/singularitygs/gutters/_add.scss
singularitygs-1.6.2 stylesheets/singularitygs/gutters/_add.scss
singularitygs-1.6.1 stylesheets/singularitygs/gutters/_add.scss
singularitygs-1.5.1 stylesheets/singularitygs/gutters/_add.scss
singularitygs-1.5.0 stylesheets/singularitygs/gutters/_add.scss
singularitygs-1.4.0 stylesheets/singularitygs/gutters/_add.scss
singularitygs-1.3.0 stylesheets/singularitygs/gutters/_add.scss
singularitygs-1.2.3 stylesheets/singularitygs/gutters/_add.scss
singularitygs-1.2.1 stylesheets/singularitygs/gutters/_add.scss
singularitygs-1.2.0 stylesheets/singularitygs/gutters/_add.scss
singularitygs-1.2.0.rc.6 stylesheets/singularitygs/gutters/_add.scss
singularitygs-1.2.0.rc.3 stylesheets/singularitygs/gutters/_add.scss
singularitygs-1.2.0.rc.1 stylesheets/singularitygs/gutters/_add.scss