From a66d9a3d50db775e75266c88b1d1ef1f079681f6 Mon Sep 17 00:00:00 2001 From: Martijn Cuppens Date: Sat, 18 Apr 2020 12:09:01 +0200 Subject: [PATCH] Backport #30605 grid: checks for `$grid-columns > 0` --- scss/mixins/_grid-framework.scss | 31 +++++++++++++++++++------------ 1 file changed, 19 insertions(+), 12 deletions(-) diff --git a/scss/mixins/_grid-framework.scss b/scss/mixins/_grid-framework.scss index 051379761572..191fb5650e99 100644 --- a/scss/mixins/_grid-framework.scss +++ b/scss/mixins/_grid-framework.scss @@ -15,12 +15,15 @@ @each $breakpoint in map-keys($breakpoints) { $infix: breakpoint-infix($breakpoint, $breakpoints); - // Allow columns to stretch full width below their breakpoints - @for $i from 1 through $columns { - .col#{$infix}-#{$i} { - @extend %grid-column; + @if $columns > 0 { + // Allow columns to stretch full width below their breakpoints + @for $i from 1 through $columns { + .col#{$infix}-#{$i} { + @extend %grid-column; + } } } + .col#{$infix}, .col#{$infix}-auto { @extend %grid-column; @@ -47,9 +50,11 @@ @include make-col-auto(); } - @for $i from 1 through $columns { - .col#{$infix}-#{$i} { - @include make-col($i, $columns); + @if $columns > 0 { + @for $i from 1 through $columns { + .col#{$infix}-#{$i} { + @include make-col($i, $columns); + } } } @@ -61,11 +66,13 @@ .order#{$infix}-#{$i} { order: $i; } } - // `$columns - 1` because offsetting by the width of an entire row isn't possible - @for $i from 0 through ($columns - 1) { - @if not ($infix == "" and $i == 0) { // Avoid emitting useless .offset-0 - .offset#{$infix}-#{$i} { - @include make-col-offset($i, $columns); + @if $columns > 0 { + // `$columns - 1` because offsetting by the width of an entire row isn't possible + @for $i from 0 through ($columns - 1) { + @if not ($infix == "" and $i == 0) { // Avoid emitting useless .offset-0 + .offset#{$infix}-#{$i} { + @include make-col-offset($i, $columns); + } } } }