Problem: map.get()
doesn't work. map-get()
does work.
I set up a map of color values and created a simple function to retrieve them.
While doing the retrieval, I followed the Sass documentation which states that you can retrieve a map value using the map.get()
function. Using this or any other map.function
results in an Error: There is no module with the namespace "map".
.
Checking out the map module, I noticed an alternative syntax, map-get()
, which does work.
What gives? Am I missing something, like importing the map module, so that I can use it in that form?
Check out my code below:
// Using npm dart `sass 1.26.11`.
$colors: ('primary': black, 'secondary': white);
// Doesn't work
@function color($color) {
@return map.get($colors, $color);
}
// Does work
@function color($color) {
@return map-get($colors, $color);
}
@use "sass:map";
command to make it work. I don't get why this is not explicitly said in the documentation. – Ewold