- Issue created by @sime
- Assigned to sarwan_verma
- Issue was unassigned.
- ๐ฎ๐ณIndia sarwan_verma
Hi @sime,
I have fixed this issue Passing percentage units to the global abs() function is deprecated and also attached patch,
please review and verify. - Status changed to Needs review
about 1 year ago 11:29am 10 October 2023 - ๐บ๐ธUnited States kclarkson Atlanta, Georiga
Good stuff. I just noticed this deprecation today.
Installed the patch and it removed my compiling errors.
- Status changed to RTBC
10 months ago 2:03pm 9 February 2024 - Status changed to Postponed: needs info
9 months ago 2:36pm 29 February 2024 - ๐ฆ๐บAustralia VladimirAus Brisbane, Australia
Why didn't you use recordation from compiler?
To preserve current behavior: math.abs(40%)
- Status changed to Needs review
9 months ago 1:22am 1 March 2024 - ๐ฆ๐บAustralia sime Melbourne
I see my steps to reproduce are different to the installation instructions, so I assume didn't set it up correctly?
- ๐จ๐ฆCanada robbdavis
I'm getting this warning too.
I set up gulp to trigger my sass watch. So not sure the error is due to the way I set up sass to compile or if this is a legitimate deprecation warning due to using the most recent version of sass?
Deprecation Warning: Passing percentage units to the global abs() function is deprecated. In the future, this will emit a CSS abs() function to be resolved by the browser. To preserve current behavior: math.abs(40%) To emit a CSS abs() now: abs(#{40%}) More info: https://sass-lang.com/d/abs-percent โท 6 โ $alert-color: mix($value, color-contrast($alert-background), abs($alert-color-scale));
- ๐จ๐ฆCanada robbdavis
OK I tried using math.abs() but it wasn't working until I found you need to use @use 'sass:math' at the top of the file. Not sure how to create a patch file so here's the code that works for _theme.scss:
@use 'sass:math'; @each $state, $value in $theme-colors { $alert-background: shift-color($value, $alert-bg-scale); $alert-border: shift-color($value, $alert-border-scale); $alert-color: shift-color($value, $alert-color-scale); @if (contrast-ratio($alert-background, $alert-color) < $min-contrast-ratio) { $alert-color: mix($value, color-contrast($alert-background), math.abs($alert-color-scale)); } .color-#{$state} { --#{$prefix}alert-color: #{$alert-color}; --#{$prefix}alert-bg: #{$alert-color}; --#{$prefix}alert-border-color: #{$alert-border}; // @todo: remove .alert-link and enable line below when 5.2 is removed. //--#{$prefix}alert-link-color: shade-color($alert-color, 20%); .alert-link { color: shade-color($alert-color, 20%); } } }
- ๐ฉ๐ชGermany stefan.korn Jossgrund
stefan.korn โ made their first commit to this issueโs fork.
- ๐ฉ๐ชGermany stefan.korn Jossgrund
I changed the MR to comply with #13 and take advise from #10:
Why didn't you use recordation from compiler?
To preserve current behavior: math.abs(40%)Reverted the change in dist/bootstrap/5.2.3/scss/_alert.scss, because bootstrap itself is using this: https://github.com/twbs/bootstrap/blob/v5.2.3/scss/_alert.scss#L65 (so probably this won't get changed anymore for BS 5.2)
including patch from MR
- ๐ฎ๐ณIndia ravi kant Jaipur
ravi kant โ changed the visibility of the branch '3391813-passing-percentage-units' to hidden.
- ๐บ๐ธUnited States Kasey_MK
Diff from #15 seems to do the trick - thank you!
- Status changed to RTBC
4 months ago 3:32am 8 August 2024 - ๐ฆ๐บAustralia fenstrat Australia
Confirmed the MR is ready to go. This also applies to 4.0.x.