Skip to content

Commit

Permalink
fix(sass): use map.get instead of map-get to avoid deprecation wa…
Browse files Browse the repository at this point in the history
…rnings

Error:
- Deprecation Warning: Global built-in functions are deprecated and will be removed in Dart Sass 3.0.0.
Use map.get 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.get` instead of `map-get()`:
From `map-get($breakpoints, $breakpoint)` to `map.get($breakpoints, $breakpoint)`.

References:
- https://sass-lang.com/d/import
- https://sass-lang.com/documentation/modules/map/#get
  • Loading branch information
beatrizsmerino committed Oct 22, 2024
1 parent aadf513 commit bfa2615
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/assets/scss/tools/tools-media.scss
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
// ------------------
@use "sass:list";
@use "sass:meta";
@use "sass:map";
@use "../settings/settings-breakpoints" as *;

@function contains($list, $item) {
Expand Down Expand Up @@ -37,7 +38,7 @@
}
} @else if meta.variable-exists(breakpoints) {
@if map-has-key($breakpoints, $breakpoint) {
@media (#{$rule}-#{$dimension}: #{inspect(map-get($breakpoints, $breakpoint))}) {
@media (#{$rule}-#{$dimension}: #{inspect(map.get($breakpoints, $breakpoint))}) {
@content;
}
} @else {
Expand Down

0 comments on commit bfa2615

Please sign in to comment.