1
0
mirror of https://github.com/twbs/bootstrap.git synced 2025-08-22 13:13:03 +02:00
grid: checks for `$grid-columns > 0`
This commit is contained in:
Martijn Cuppens
2020-04-18 12:09:01 +02:00
committed by XhmikosR
parent 9d0097013a
commit a66d9a3d50

View File

@@ -15,12 +15,15 @@
@each $breakpoint in map-keys($breakpoints) { @each $breakpoint in map-keys($breakpoints) {
$infix: breakpoint-infix($breakpoint, $breakpoints); $infix: breakpoint-infix($breakpoint, $breakpoints);
@if $columns > 0 {
// Allow columns to stretch full width below their breakpoints // Allow columns to stretch full width below their breakpoints
@for $i from 1 through $columns { @for $i from 1 through $columns {
.col#{$infix}-#{$i} { .col#{$infix}-#{$i} {
@extend %grid-column; @extend %grid-column;
} }
} }
}
.col#{$infix}, .col#{$infix},
.col#{$infix}-auto { .col#{$infix}-auto {
@extend %grid-column; @extend %grid-column;
@@ -47,11 +50,13 @@
@include make-col-auto(); @include make-col-auto();
} }
@if $columns > 0 {
@for $i from 1 through $columns { @for $i from 1 through $columns {
.col#{$infix}-#{$i} { .col#{$infix}-#{$i} {
@include make-col($i, $columns); @include make-col($i, $columns);
} }
} }
}
.order#{$infix}-first { order: -1; } .order#{$infix}-first { order: -1; }
@@ -61,6 +66,7 @@
.order#{$infix}-#{$i} { order: $i; } .order#{$infix}-#{$i} { order: $i; }
} }
@if $columns > 0 {
// `$columns - 1` because offsetting by the width of an entire row isn't possible // `$columns - 1` because offsetting by the width of an entire row isn't possible
@for $i from 0 through ($columns - 1) { @for $i from 0 through ($columns - 1) {
@if not ($infix == "" and $i == 0) { // Avoid emitting useless .offset-0 @if not ($infix == "" and $i == 0) { // Avoid emitting useless .offset-0
@@ -72,3 +78,4 @@
} }
} }
} }
}