]> git.ipfire.org Git - thirdparty/bootstrap.git/commitdiff
Assert that $grid-breakpoints and $container-max-widths are in ascending order; fixes... 19111/head
authorChris Rebert <code@chrisrebert.com>
Sun, 7 Feb 2016 10:53:35 +0000 (02:53 -0800)
committerChris Rebert <code@chrisrebert.com>
Sun, 7 Feb 2016 10:53:37 +0000 (02:53 -0800)
[skip sauce]

scss/_variables.scss

index a375e9962683dec2d639d4d8aad90bd94e4c20d8..6cf0c6338ab33d63c03669c1130354f21b976987 100644 (file)
 // Fonts
 // Components
 
+@mixin _assert-ascending($map, $map-name) {
+  $prev-key: null;
+  $prev-num: null;
+  @each $key, $num in $map {
+    @if $prev-num != null and $prev-num >= $num {
+      @warn "Invalid value for #{$map-name}: This map must be in ascending order, but key '#{$key}' has value #{$num} which isn't greater than #{$prev-num}, the value of the previous key '#{$prev-key}' !";
+    }
+    $prev-key: $key;
+    $prev-num: $num;
+  }
+}
+
 // General variable structure
 //
 // Variable format should follow the `$component-modifier-state-property` order.
@@ -112,6 +124,7 @@ $grid-breakpoints: (
   lg: 992px,
   xl: 1200px
 ) !default;
+@include _assert-ascending($grid-breakpoints, "$grid-breakpoints");
 
 
 // Grid containers
@@ -124,6 +137,7 @@ $container-max-widths: (
   lg: 940px,
   xl: 1140px
 ) !default;
+@include _assert-ascending($container-max-widths, "$container-max-widths");
 
 
 // Grid columns