// --------------------------------------------------------------------------- // 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; } } }