From b940cbdb9f8e5e3c2b7a8391909a82650082d6a6 Mon Sep 17 00:00:00 2001 From: Hieu Tran Date: Wed, 23 Nov 2022 19:50:01 +0700 Subject: [PATCH] support dart sass 2.0.0 --- fork-versions/default/_normalize.scss | 5 +++-- fork-versions/default/_vertical-rhythm.scss | 7 ++++--- sass/normalize/_normalize-mixin.scss | 8 +++++--- sass/normalize/_vertical-rhythm.scss | 7 ++++--- 4 files changed, 16 insertions(+), 11 deletions(-) diff --git a/fork-versions/default/_normalize.scss b/fork-versions/default/_normalize.scss index 30c596962..9ca6020d9 100644 --- a/fork-versions/default/_normalize.scss +++ b/fork-versions/default/_normalize.scss @@ -1,4 +1,5 @@ /*! normalize-scss | MIT/GPLv2 License | bit.ly/normalize-scss */ +@use "sass:math"; @import 'variables'; @import 'vertical-rhythm'; @@ -32,12 +33,12 @@ html { @if $base-font-size != 16px or $normalize-vertical-rhythm { // Correct old browser bug that prevented accessible resizing of text // when root font-size is set with px or em. - font-size: ($base-font-size / 16px) * 100%; + font-size: math.div($base-font-size, 16px) * 100%; } @if $normalize-vertical-rhythm { // Establish a vertical rhythm unit using $base-font-size and // $base-line-height variables. - line-height: ($base-line-height / $base-font-size) * 1em; /* 1 */ + line-height: math.div($base-line-height, $base-font-size) * 1em; /* 1 */ } @else { line-height: 1.15; /* 1 */ diff --git a/fork-versions/default/_vertical-rhythm.scss b/fork-versions/default/_vertical-rhythm.scss index 4f53647ca..1097fe96e 100644 --- a/fork-versions/default/_vertical-rhythm.scss +++ b/fork-versions/default/_vertical-rhythm.scss @@ -1,3 +1,4 @@ +@use "sass:math"; // // Vertical Rhythm // @@ -10,10 +11,10 @@ @error "The normalize vertical-rhythm module only supports px inputs. The typey library is better."; } @if $unit == rem { - @return ($value / $base-font-size) * 1rem; + @return math.div($value, $base-font-size) * 1rem; } @else if $unit == em { - @return ($value / $relative-to) * 1em; + @return math.div($value, $relative-to) * 1em; } @else { // $unit == px @return $value; @@ -52,7 +53,7 @@ } @mixin normalize-line-height($font-size, $min-line-padding: 2px) { - $lines: ceil($font-size / $base-line-height); + $lines: ceil(math.div($font-size, $base-line-height)); // If lines are cramped include some extra leading. @if ($lines * $base-line-height - $font-size) < ($min-line-padding * 2) { $lines: $lines + 1; diff --git a/sass/normalize/_normalize-mixin.scss b/sass/normalize/_normalize-mixin.scss index a366f7b9e..0f53a6913 100644 --- a/sass/normalize/_normalize-mixin.scss +++ b/sass/normalize/_normalize-mixin.scss @@ -1,3 +1,5 @@ +@use "sass:math"; + // Helper function for the normalize() mixin. @function _normalize-include($section, $exclude: null) { // Initialize the global variables needed by this function. @@ -61,10 +63,10 @@ @if $base-font-size != 16px or $normalize-vertical-rhythm { // Correct old browser bug that prevented accessible resizing of text // when root font-size is set with px or em. - font-size: ($base-font-size / 16px) * 100%; + font-size: math.div($base-font-size, 16px) * 100%; } @if $normalize-vertical-rhythm { - line-height: ($base-line-height / $base-font-size) * 1em; /* 1 */ + line-height: math.div($base-line-height, $base-font-size) * 1em; /* 1 */ } @else { line-height: 1.15; /* 1 */ @@ -419,7 +421,7 @@ font-family: if($base-font-family, $base-font-family, sans-serif); /* 1 */ font-size: 100%; /* 1 */ @if $normalize-vertical-rhythm { - line-height: ($base-line-height / $base-font-size) * 1em; /* 1 */ + line-height: math.div($base-line-height, $base-font-size) * 1em; /* 1 */ } @else { line-height: 1.15; /* 1 */ diff --git a/sass/normalize/_vertical-rhythm.scss b/sass/normalize/_vertical-rhythm.scss index 4f53647ca..1097fe96e 100644 --- a/sass/normalize/_vertical-rhythm.scss +++ b/sass/normalize/_vertical-rhythm.scss @@ -1,3 +1,4 @@ +@use "sass:math"; // // Vertical Rhythm // @@ -10,10 +11,10 @@ @error "The normalize vertical-rhythm module only supports px inputs. The typey library is better."; } @if $unit == rem { - @return ($value / $base-font-size) * 1rem; + @return math.div($value, $base-font-size) * 1rem; } @else if $unit == em { - @return ($value / $relative-to) * 1em; + @return math.div($value, $relative-to) * 1em; } @else { // $unit == px @return $value; @@ -52,7 +53,7 @@ } @mixin normalize-line-height($font-size, $min-line-padding: 2px) { - $lines: ceil($font-size / $base-line-height); + $lines: ceil(math.div($font-size, $base-line-height)); // If lines are cramped include some extra leading. @if ($lines * $base-line-height - $font-size) < ($min-line-padding * 2) { $lines: $lines + 1;