You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I ran into a Sass compiler error recently with a combination of lists and maps.
What I have is a list containing a number of maps. This works without any problems until I only have a single map in that list.
At that point Sass requires a trailing comma after the list item, otherwise it will not be recognized as a map:
The issue here is that (<expr>) is parsed as just <expr> wrapped in parentheses, rather than a single item list, so $list-of-maps is just a map without the trailing comma, rather than a list with one item.
To write a single-item list in Sass, you either need to add a trailing comma after the item to indicate that the parentheses are making a list, or you can use square brackets for your list. See the documentation on lists here.
Yes, I assumed that this had some kind of reasonable purpose, was mostly wondering if that edge case is documented somewhere. However, now it's findable via an issues search, which is something I guess. 😁
I ran into a Sass compiler error recently with a combination of lists and maps.
What I have is a list containing a number of maps. This works without any problems until I only have a single map in that list.
At that point Sass requires a trailing comma after the list item, otherwise it will not be recognized as a map:
This produces the following error:
However, the code compiles correctly if a trailing comma is added after the list item:
I have created a minimal reproduction repo here.
The text was updated successfully, but these errors were encountered: