Sass map.get() doesn’t work. map-get() does. What gives?

I am having a similar issue as OP (using dart-sass v1.25.0), and only map-get works, map.get doesn’t.

The documentation doesn’t seem to be very clear on this, but the (Sass Module System: Draft 6) document on Github explains it better.

It seems like Sass is moving on to using @use in favour of @import for better compatibility with native CSS, and in order to get access to map.get you now must explicitly import the map module using the @use keyword.

So using OP’s example, map.get should work:

@use "sass:map";

$colors: ('primary': black, 'secondary': white);

@function color($color) {
  @return map.get($colors, $color);
}

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)