Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

map inside of a list bug #1935

Closed
GrtDev opened this issue Dec 14, 2015 · 2 comments
Closed

map inside of a list bug #1935

GrtDev opened this issue Dec 14, 2015 · 2 comments

Comments

@GrtDev
Copy link

GrtDev commented Dec 14, 2015

When you put a single map inside of a list, SASS somehow only grabs the first key/value pair as a list when you try to loop through it? Resulting in an error when you attempt a map-get function.

When you put multiple maps inside of a list it works as expected.

Example here: http://codepen.io/Sector22/pen/PZPxPp?editors=010

@chriseppstein
Copy link

Parenthesis do not define a list with the exception of () defining an empty list. In all other cases, parenthesis are simply grouping of expressions. Lists are defined by their use of separators.

// parenthesis here are redundant
$list: ($some-map);
// this is just simple assignment of a map to a variable named $list.
$list: $some-map;

To define a list of a single element, you must have a trailing comma and it is often necessary to use parenthesis around that list to avoid that comma from changing the interpretation of the remaining expression.

// valid list of one element containing a map
$list: $some-map, ;
// this is the same, but some find it more robust and aesthetically pleasing to keep the parenthesis.
$list: ($some-map,) ;

@GrtDev
Copy link
Author

GrtDev commented Dec 16, 2015

Hi @chriseppstein ,

Thank you so much for clearing this up for me! This makes much more sense.

Cheers!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants