Advertisement
Guest User

Untitled

a guest
Apr 14th, 2017
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
SAS 1.73 KB | None | 0 0
  1. @mixin make-grid-columns($columns: $grid-columns, $gutters: $grid-gutter-widths, $breakpoints: $grid-breakpoints) {
  2.   // Common properties for all breakpoints
  3.   %grid-column {
  4.     position: relative;
  5.     width: 100%;
  6.     min-height: 1px; // Prevent columns from collapsing when empty
  7.  
  8.     @include make-gutters($gutters);
  9.   }
  10.  
  11.   @each $breakpoint in map-keys($breakpoints) {
  12.     $infix: breakpoint-infix($breakpoint, $breakpoints);
  13.  
  14.     // Allow columns to stretch full width below their breakpoints
  15.     @for $i from 1 through $columns {
  16.       .col#{$infix}-#{$i} {
  17.         @extend %grid-column;
  18.       }
  19.     }
  20.     .col#{$infix},
  21.     .col#{$infix}-auto {
  22.       @extend %grid-column;
  23.     }
  24.  
  25.     @include media-breakpoint-up($breakpoint, $breakpoints) {
  26.       // Provide basic `.col-{bp}` classes for equal-width flexbox columns
  27.       .col#{$infix} {
  28.         flex-basis: 0;
  29.         flex-grow: 1;
  30.         max-width: 100%;
  31.       }
  32.       .col#{$infix}-auto {
  33.         flex: 0 0 auto;
  34.         width: auto;
  35.       }
  36.  
  37.       @for $i from 1 through $columns {
  38.         .col#{$infix}-#{$i} {
  39.           @include make-col($i, $columns);
  40.         }
  41.       }
  42.  
  43.       @each $modifier in (pull, push) {
  44.         @for $i from 0 through $columns {
  45.           .#{$modifier}#{$infix}-#{$i} {
  46.             @include make-col-modifier($modifier, $i, $columns)
  47.           }
  48.         }
  49.       }
  50.  
  51.       // `$columns - 1` because offsetting by the width of an entire row isn't possible
  52.      @for $i from 0 through ($columns - 1) {
  53.        @if not ($infix == "" and $i == 0) { // Avoid emitting useless .offset-xs-0
  54.          .offset#{$infix}-#{$i} {
  55.            @include make-col-modifier(offset, $i, $columns)
  56.          }
  57.        }
  58.      }
  59.    }
  60.  }
  61. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement