// --------------------------------------------------------------------------- // 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, $column-width : false, $gutter-width : false, $legacy-support : false, $is-fluid : $is-fluid ) { // 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) $column-width $gutter-width $legacy-support $is-fluid ); // Storing layout $layouts: append( $layouts, $layout, comma ) !global; @return $layout; } // --------------------------------------------------------------------------- // @mixin at-layout @mixin at-layout( $layout, $legacy-support : false ) { // Storing reference to global variables $at-breakpoint-ref : $at-breakpoint; $is-fluid-ref : $is-fluid; $total-columns-ref : $total-columns; $grid-padding-ref : $grid-padding; $column-width-ref : $column-width; $gutter-width-ref : $gutter-width; // Using settings from layout $total-columns : nth( $layout, 1 ) !global; $grid-padding : nth( $layout, 2 ) !global; $at-breakpoint : nth( $layout, 3 ) !global; $column-width : nth( $layout, 4 ) !global; $gutter-width : nth( $layout, 5 ) !global; $is-fluid : nth( $layout, 7 ) !global; // Use general settings if false @if not $grid-padding { $grid-padding : $grid-padding-ref !global; } @if not $column-width { $column-width : $column-width-ref !global; } @if not $gutter-width { $gutter-width : $gutter-width-ref !global; } // Get legacy support setting from layout if not forced @if not $legacy-support { $legacy-support : nth( $layout, 6 ); } @if $at-breakpoint { @include at-breakpoint( $at-breakpoint $legacy-support ) { @content; } } @else { @content; } // Resetting references to original values $at-breakpoint : $at-breakpoint-ref !global; $is-fluid : $is-fluid-ref !global; $total-columns : $total-columns-ref !global; $grid-padding : $grid-padding-ref !global; $column-width : $column-width-ref !global; $gutter-width : $gutter-width-ref !global; } // --------------------------------------------------------------------------- // @mixin each-layout @mixin each-layout( $layouts: $layouts ) { @each $layout in $layouts { @include at-layout( $layout ) { @content; } } }