bootstrap: WARNING Potentially invalid value for $container-max-widths

Hello, I have warning when trying compile styles with this variables:

$container-max-widths: (
				sm: 540px,
				md: 720px,
				lg: 960px,
				xl: 92%
);
@include _assert-ascending($container-max-widths, "$container-max-widths");

Message: WARNING: Potentially invalid value for $container-max-widths: This map must be in ascending order, but key 'xl' has value 92% whose unit makes it incomparable to 960px, the value of the previous key 'lg' !

I think what this block is wrong and should ignore the specified values in percentage

@each $key, $num in $map {
    @if $prev-num == null {
      // Do nothing
    } @else if not comparable($prev-num, $num) {
      @warn "Potentially invalid value for #{$map-name}: This map must be in ascending order, but key '#{$key}' has value #{$num} whose unit makes it incomparable to #{$prev-num}, the value of the previous key '#{$prev-key}' !";
    } @else if $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;
  }

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Reactions: 2
  • Comments: 20 (9 by maintainers)

Most upvoted comments

there is the same problem with width in “vw”

WARNING: Potentially invalid value for $container-max-widths: This map must be in ascending order, but key ‘lg’ has value 100vw whose unit makes it incomparable to 960px, the value of the previous key ‘md’ ! on line 14 of node_modules/bootstrap/scss/_functions.scss, in mixin -assert-ascending from line 214 of node_modules/bootstrap/scss/_variables.scss from line 9 of node_modules/bootstrap/scss/bootstrap.scss from line 4 of stdin

We have the same use-case as @romanlex where the container-max-width of xl is 100%. Sure, the perfect solution would be to allow percentage values. But we would also be happy with a dumb switch to entirely disable the asserts.

Please don’t highlight me. Thanks!