Skip to content

Commit

Permalink
fix(sass): use map.has-key instead of map-has-key to avoid deprec…
Browse files Browse the repository at this point in the history
…ation warnings

Error:
- Deprecation Warning: Global built-in functions are deprecated and will be removed in Dart Sass 3.0.0.
Use map.has-key instead.

Reason:
- We are deprecating the global functions now that the module system has been available for several years in sass: modules.
While Dart Sass 2.0.0 will be released soon with various smaller breaking changes, we don’t expect to remove Sass @import rules or global built-in functions until Dart Sass 3.0.0, which will be released no sooner than two years after Dart Sass 1.80.0.

Solution:
- Import the `sass:map` module to use the functions: `@use "sass:map"`
You can't do these imports in the main `styles.scss` file, it doesn't work, you must do it in the file you are going to use it in.
- Use `map.has-key` instead of `map-has-key()`:
From `map-has-key($breakpoints, $breakpoint)` to `map.has-key($breakpoints, $breakpoint)`.

References:
- https://sass-lang.com/d/import
- https://sass-lang.com/documentation/modules/map/#has-key
  • Loading branch information
beatrizsmerino committed Oct 22, 2024
1 parent bfa2615 commit 3912550
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/assets/scss/tools/tools-media.scss
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
@error 'Invalid units provided';
}
} @else if meta.variable-exists(breakpoints) {
@if map-has-key($breakpoints, $breakpoint) {
@if map.has-key($breakpoints, $breakpoint) {
@media (#{$rule}-#{$dimension}: #{inspect(map.get($breakpoints, $breakpoint))}) {
@content;
}
Expand Down

0 comments on commit 3912550

Please sign in to comment.