Sha256: 81e871c3e9742b24537db2b81ffae397d295557d924c8656771d0cdcc5451fca

Contents?: true

Size: 1.94 KB

Versions: 4

Compression:

Stored size: 1.94 KB

Contents

// ---------------------------------------------------------------------------
// Importing dependencies

@import "../media";

// ---------------------------------------------------------------------------
// Layout store, for use in each-layout

$layouts: ();

// ---------------------------------------------------------------------------
// @function set-layout

@function set-layout(
  $columns,
  $grid-padding   : false,
  $at-breakpoint  : false,
  $legacy-support : false
  ) {

  // Catching media breakpoints from set-breakpoint
  @if type-of( $at-breakpoint ) == "list" {
    @if ( not $legacy-support ) and length( $at-breakpoint ) > 1 {
      // Inheriting legacy support setting from set-breakpoint
      $legacy-support: nth( $at-breakpoint, 2 );
      $at-breakpoint: nth( $at-breakpoint, 1 );
    }
  }

  $layout: ( $columns ($grid-padding) ($at-breakpoint) $legacy-support );

  // Storing layout
  $layouts: append( $layouts, $layout, comma );

  @return $layout;

}

// ---------------------------------------------------------------------------
// @mixin at-layout

@mixin at-layout( $layout ) {

  // Storing reference to global variables
  $at-breakpoint-ref  : $at-breakpoint;
  $total-columns-ref  : $total-columns;
  $grid-padding-ref   : $grid-padding;

  $total-columns  : nth( $layout, 1 );
  $grid-padding   : nth( $layout, 2 );
  $at-breakpoint  : nth( $layout, 3 );
  $legacy-support : nth( $layout, 4 );

  @if $at-breakpoint {
    @include at-breakpoint( $at-breakpoint $legacy-support ) {
      @content;
    }
  } @else {
    @content;
  }

  // Resetting references to original values
  $at-breakpoint  : $at-breakpoint-ref;
  $total-columns  : $total-columns-ref;
  $grid-padding   : $grid-padding-ref;

}

// ---------------------------------------------------------------------------
// @mixin each-layout

@mixin each-layout( $layouts: $layouts ) {
  @each $layout in $layouts {
    @include at-layout( $layout ) {
      @content;
    }
  }
}

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
ezy-0.2.9 sass/ezy/grid/_layout.scss
ezy-0.2.8 sass/ezy/grid/_layout.scss
ezy-0.2.7.alpha sass/ezy/grid/_layout.scss
ezy-0.2.6.alpha sass/ezy/grid/_layout.scss