Skip to content
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 Sass deprecation on mix function (passing a number without unit) #995

Merged
merged 1 commit into from
Aug 19, 2024

Conversation

paulrobertlloyd
Copy link
Contributor

Description

SASS is showing the following deprecation warning. Example:

Deprecation Warning: $weight: Passing a number without unit % (50%*%) is deprecated.

To preserve current behavior: calc($weight / 1% / 1% * 1%)

More info: https://sass-lang.com/d/function-units

   ╷
72 │   @return mix(black, $color, $percentage * 1%);
   │           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   ╵
    packages/core/settings/_colours.scss 72:11  shade()
    packages/core/settings/_colours.scss 90:29  @import
    packages/core/settings/_all.scss 6:9        @import
    packages/core/all.scss 6:9                  @import
    packages/nhsuk.scss 2:9                     root stylesheet

As we are always passing a percentage to the tint and shade functions, we don’t need to multiple the incoming value by 1%. This resolves this warning.

Checklist

@paulrobertlloyd paulrobertlloyd changed the title Fix SASS deprecation on mix function Fix SASS deprecation on mix function Aug 19, 2024
@paulrobertlloyd paulrobertlloyd changed the title Fix SASS deprecation on mix function Fix Sass deprecation on mix function (passing a number without unit) Aug 19, 2024
Copy link
Contributor

@frankieroberto frankieroberto left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah good stuff, this has been annoying me too.

@paulrobertlloyd paulrobertlloyd merged commit 7118439 into main Aug 19, 2024
2 checks passed
@paulrobertlloyd paulrobertlloyd deleted the sass-mix-deprecation branch August 19, 2024 17:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants