Issue
In this function I compile rem to px and em to px.
$base: 16 !default;
@function scut-strip-unit ($num) {
@return $num / ($num * 0 + 1);
}
@function rem ($pixels) {
@return scut-strip-unit($pixels) / $base * 1rem;
}
@function em ($pixels, $context: $base) {
@return #{$pixels/$context}em;
}
But with sass v1.49, we are facing this error:
Error
Deprecation Warning: Using / for division outside of calc() is deprecated and will be removed in Dart Sass 2.0.0.
Recommendation: math.div(scut-strip-unit($pixels), $base) or calc(scut-strip-unit($pixels) / $base)
More info and automated migrator: https://sass-lang.com/d/slash-div
╷
8 │ @return scut-strip-unit($pixels) / $base * 1rem;
Solution
What it's saying is that you should be using the math.div from sass:math to make divisions, like so:
@use "sass:math";
@function to-rem($pxNb) {
@return math.div($pxNb, 16) * 1rem;
}
Answered By - yousoumar
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.