-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[WIP] dart-sass compatibility tweaks #4298
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,6 @@ | ||
// stylelint-disable-next-line scss/partial-no-import | ||
@use "sass:math"; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is going to be an issue. Code in In order to not require a specific major version of polaris to be tied to a specific version of sewing-kit this either needs to be reworked, and either we remove these utilities from polaris (color() is considered not desired but its usage in consuming apps is pervasive which means it's hard to remove) before performing the migration to dart-sass or we come up with some way to support both node-sass and dart-sass. On the up-side it's been agreed upon that having a sass API is not desired, and it causes more hassle than desired, however work to actually remove it is slow going. |
||
|
||
@import '../polaris-tokens/colors.color-map'; | ||
|
||
/// | ||
|
@@ -69,9 +71,9 @@ $color-palette-data: map-extend( | |
$background: rgb(255, 255, 255); | ||
} | ||
|
||
$red: red($background) * red($foreground) / 255; | ||
$green: green($background) * green($foreground) / 255; | ||
$blue: blue($background) * blue($foreground) / 255; | ||
$red: math.div(red($background) * red($foreground), 255); | ||
$green: math.div(green($background) * green($foreground), 255); | ||
$blue: math.div(blue($background) * blue($foreground), 255); | ||
|
||
$opacity: opacity($foreground); | ||
$background-opacity: opacity($background); | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,7 +14,7 @@ $font-family-data: ( | |
Consolas, | ||
Liberation Mono, | ||
Menlo, | ||
monospace !default}, | ||
monospace}, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This looks like a straight up bug and we can remove this in a separate pr There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
); | ||
|
||
$line-height-data: ( | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
@use "sass:math"; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Another case where dart-sass only code is introduced to the public sass API |
||
|
||
$default-browser-font-size: 16px; | ||
$base-font-size: 10px; | ||
|
||
|
@@ -13,9 +15,9 @@ $base-font-size: 10px; | |
} @else if $unit == 'rem' { | ||
@return $value; | ||
} @else if $unit == 'px' { | ||
@return $value / $base-font-size * 1rem; | ||
@return math.div($value, $base-font-size) * 1rem; | ||
} @else if $unit == 'em' { | ||
@return $unit / 1em * 1rem; | ||
@return math.div($unit, 1em) * 1rem; | ||
} @else { | ||
@error 'Value must be in px, em, or rem.'; | ||
} | ||
|
@@ -33,9 +35,9 @@ $base-font-size: 10px; | |
} @else if $unit == 'px' { | ||
@return $value; | ||
} @else if $unit == 'em' { | ||
@return ($value / 1em) * $base-font-size; | ||
@return math.div($value, 1em) * $base-font-size; | ||
} @else if $unit == 'rem' { | ||
@return ($value / 1rem) * $base-font-size; | ||
@return math.div($value, 1rem) * $base-font-size; | ||
} @else { | ||
@error 'Value must be in rem, em, or px.'; | ||
} | ||
|
@@ -54,9 +56,9 @@ $base-font-size: 10px; | |
} @else if $unit == 'em' { | ||
@return $value; | ||
} @else if $unit == 'rem' { | ||
@return $value / 1rem * 1em * ($base-font-size / $default-browser-font-size); | ||
@return math.div($value, 1rem) * 1em * math.div($base-font-size, $default-browser-font-size); | ||
} @else if $unit == 'px' { | ||
@return $value / $default-browser-font-size * 1em; | ||
@return math.div($value, $default-browser-font-size) * 1em; | ||
} @else { | ||
@error 'Value must be in px, rem, or em.'; | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We will want to use
sass.renderSync
, which is apparently the faster of the two methods. I did a similar thing in here