Skip to content

Commit

Permalink
Fix remaining math.div issues
Browse files Browse the repository at this point in the history
  • Loading branch information
Snugug committed Aug 14, 2022
1 parent f03d3e7 commit 8f400aa
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 9 deletions.
8 changes: 4 additions & 4 deletions stylesheets/breakpoint/_helpers.scss
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
$base-unit: unit(breakpoint-get('base font size'));

@if $base-unit == 'px' or $base-unit == '%' or $base-unit == 'em' or $base-unit == 'pt' {
@return base-conversion($value) / base-conversion(breakpoint-get('base font size')) * 1em;
@return math.div(base-conversion($value), base-conversion(breakpoint-get('base font size'))) * 1em;
}
@else {
@warn '#{breakpoint-get(\'base font size\')} is not set in valid units for font size!';
Expand All @@ -28,16 +28,16 @@
$unit: unit($value);
@if $unit == 'px' {
@return math.div($value / 16px) * 1em;
@return math.div($value, 16px) * 1em;
}
@else if $unit == '%' {
@return math.div($value / 100%) * 1em;
@return math.div($value, 100%) * 1em;
}
@else if $unit == 'em' {
@return $value;
}
@else if $unit == 'pt' {
@return math.div($value / 12pt) * 1em;
@return math.div($value, 12pt) * 1em;
}
@else {
@return $value;
Expand Down
12 changes: 7 additions & 5 deletions stylesheets/breakpoint/parsers/resolution/_resolution.scss
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
@use "sass:math";

@function breakpoint-make-resolutions($resolution) {
$length: length($resolution);

Expand Down Expand Up @@ -34,8 +36,8 @@
// Write out feature tests
$webkit: '';
$moz: '';
$webkit: '(-webkit-#{$feature}device-pixel-ratio: #{$value / $base})';
$moz: '(#{$feature}-moz-device-pixel-ratio: #{$value / $base})';
$webkit: '(-webkit-#{$feature}device-pixel-ratio: #{math.div($value, $base)})';
$moz: '(#{$feature}-moz-device-pixel-ratio: #{math.div($value, $base)})';
// Append to output
$output: append($output, $standard, space);
$output: append($output, $webkit, space);
Expand All @@ -44,9 +46,9 @@
@else {
$webkit: '';
$moz: '';
$webkit: '(-webkit-#{$feature}device-pixel-ratio: #{$value / 1dppx})';
$moz: '(#{$feature}-moz-device-pixel-ratio: #{$value / 1dppx})';
$fallback: '(#{$feature}resolution: #{$value / 1dppx * 96dpi})';
$webkit: '(-webkit-#{$feature}device-pixel-ratio: #{math.div($value, 1dppx)})';
$moz: '(#{$feature}-moz-device-pixel-ratio: #{math.div($value, 1dppx)})';
$fallback: '(#{$feature}resolution: #{math.div($value, 1dppx) * 96dpi})';
// Append to output
$output: append($output, $standard, space);
$output: append($output, $webkit, space);
Expand Down

0 comments on commit 8f400aa

Please sign in to comment.