Ignore percentage values for compare in maps#26689
Conversation
andresgalante
left a comment
There was a problem hiding this comment.
Thanks a lot @romanlex, this works and it'll give the chance to author to pick % or px.
There has been back and forwards and discussions for a very long time about the units of the breakpoints and the fact that we don't allow them to be rem or em.
I'll like @patrickhlauke and @mdo to decide what are the implications of allowing % for breakpoints.
Also if we merge this, there should be also a change in the docs here:
http://getbootstrap.com/docs/4.1/layout/grid/#grid-options
|
@andresgalante , @patrickhlauke @mdo : Would be really nice to see this change in one of the next minor releases... |
| $prev-num: null; | ||
| @each $key, $num in $map { | ||
| @if $prev-num == null { | ||
| @if $prev-num == null or unit($num) == "%" { |
There was a problem hiding this comment.
If I'm not mistaken, this only fixed % warning, if you use percentage at the biggest unit.
E.g. the bug report was: sm 500, md 700, lg 850, xl 100%.
But I have a use case, where I have only two categories: small: 80%, big: 720px. So big is never too wide for reading, but small always has a nice padding from the screen (80% width). This causes a warning still, because not the current unit is "%", but the previous unit. Can we also ignore the warning in case of unit($prev-num) == "%"?
All conversation about it in #24061 (comment)
I think this is the only solution
Short:
We cant compare percantage values with absolute values in map, but many people want use
%in$container-max-widthsFixes #24061