-
Notifications
You must be signed in to change notification settings - Fork 331
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
Fix or suppress Dart Sass deprecation warnings #3192
Conversation
4018f56
to
2b26f53
Compare
4106a2e
to
e077e5f
Compare
2b26f53
to
c8c2c57
Compare
This is a really neat solution, but I'm still hesitant about this change because:
Would be keen to get other's thoughts on this. Is there a benefit to doing this that I'm missing? |
Thanks @36degrees, appreciate this one's not crucial The real good stuff like the Sass modern compilation API for 2.0 is in this PR instead: This PR though does gives us a nice way to start using Dart Sass in spikes without hiding those warnings away. So when new deprecations arrive like "Passing a number without unit % is deprecated" we don't miss them in the terminal Alternatively BeforeReview app imports by resolving local files @import "../../../src/govuk/all"; AfterReview app imports via @import "govuk-frontend/govuk/all"; |
This bit from the
If we prefer |
Have teams reported those deprecation warnings being an issue or is it more for our own peace of mind/standard that we're trying to tidy them up? If the later (either because they don't care about the flurry or warning, or ignore them with If we were to add a division workaround, though, I think it should be unit tested, as it'd be something we'd easily reach for when building further features. I originally thought it would be worth making it public as well (should we have it), but projects where the warning would appear would us a Sass version that also offer the The implementation also looks much more complex than Bootstrap's. Are we doing something they don't (esp. the units bit and separation into two functions)? |
Regarding deprecation warnings, we'll have some joint squad decisions to make
@romaricpascal If you scroll down on this issue it's referenced fairly frequently: Deprecation warningsAssuming we're going ahead with Dart Sass, we have three options:
I've assumed we'd want 2) to reduce console spam but not hide away important messages |
@romaricpascal I hadn't actually seen Bootstrap's version when I pushed this PR up, but we're both using the same type of long division to count the number of subtractions 😊 Things they've done differently
They've used this little snippet for the last digit: @if ($precision < 0 and $remainder >= $divisor * 5) {
$result: $result + 1;
} Things I've done differently
Could definitely combine my two functions into one if preferred Or leave it out entirely! |
e077e5f
to
461ea83
Compare
c8c2c57
to
19fbc86
Compare
19fbc86
to
d69a4de
Compare
I think we should fix the '$weight: Passing a number without unit % (30) is deprecated.' warnings now, but I don't think we should be trying to reimplement My preference would be to go with option 2, but also see if there's a way to filter out the 'known' warnings – so we don't see warnings for |
461ea83
to
1ae2bf6
Compare
b16c97b
to
46bf45f
Compare
07dbd73
to
4a8ac8f
Compare
46bf45f
to
e629344
Compare
4a8ac8f
to
b6208ef
Compare
@@ -66,6 +66,9 @@ export async function compileStylesheet ([modulePath, { srcPath, destPath }]) { | |||
file: moduleSrcPath, | |||
outFile: moduleDestPath, | |||
|
|||
// Turn off dependency warnings | |||
quietDeps: true, |
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.
Whilst this PR fixes govuk-frontend
deprecation warnings we add quietDeps: true
to ignore:
govuk_frontend_toolkit
govuk-elements-sass
@36degrees Updated the description to say we've fixed these two:
Added your suggestion in this PR: We needed access to the Dart Sass modern compilation API |
e629344
to
ffa02d7
Compare
b6208ef
to
780a8d0
Compare
ffa02d7
to
5759251
Compare
780a8d0
to
f90c5ce
Compare
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.
These all feel like non-controversial changes now (having swooped in after everybody else dealt with the nitty gritty).
I'm happy to approve, but appreciate @36degrees and @romaricpascal might want to weigh in?
Dart Sass will throw when trying to `quote()` colour identifiers as it no longer treats them as unquoted strings See “Heads up!” box on Strings (Unquoted) docs: https://sass-lang.com/documentation/values/strings#unquoted
For example we can’t fix “Using / for division outside of calc() is deprecated” in: ``` govuk_frontend_toolkit govuk-elements-sass ``` See https://frontend.design-system.service.gov.uk/importing-css-assets-and-javascript/#silence-deprecation-warnings-from-dependencies-in-dart-sass
f90c5ce
to
3098cca
Compare
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.
Changes look sound to me! 🚀
This PR fixes or suppresses all deprecation warnings that show up in Dart Sass
For forwards compatibility (LibSass, Node Sass, Dart Sass) not all deprecations can be resolved
Breaking change fixes
$string: red is not a string.
Dart Sass will throw when trying to
quote()
colour identifiers as it no longer treats them as unquoted strings. We can use interpolation"#{$colour}"
so Dart Sass takesred
(color) as"red"
(string)See “Heads up!” box on Strings (Unquoted) docs:
https://sass-lang.com/documentation/values/strings#unquoted
Deprecations fixed
$weight: Passing a number without unit % (30) is deprecated.
The fix? Add units where needed
Deprecations suppressed
This PR previously recreated
math.div()
(see implementation) but we've now suppressed warnings for:These suppressions have been moved to: