-
Notifications
You must be signed in to change notification settings - Fork 55
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 keys inconsistent when using css color names #94
Comments
Actually, this might be my mistake. Just tested the latest version in isolation and it works as expected. This might be an issue from an old version, or an issue I introduced somewhere. Sorry. Will close. |
Hey, I think I'm also experiencing this issue, but I'm using the latest version ( |
Actually, I think you're right. I just tried this again on my codebase and I still have the original issue. My current solution is to re-create the variable in SASS and force keys to be of a particular type. Although it would be a lot nicer not to have to do this of course. I'm also using Dart Sass instead of Node Sass, as the latter is deprecated. However they should be fairly interchangeable.
|
Your solution works for me! Another thing that I had to make sure of was that I was using double quotes instead of single when calling But of course it would be nice for this to be fixed in the importer (if possible). |
Rather, they have to match what's used in |
I made a helper function for colors as well, which I think solves the issue of needing to use the correct quote types. Although I haven't tested that as I use prettier to force double quotes. @function get-color($color) {
@return map-get($colors, "#{$color}");
} |
I have a similar helper so I just added the quotes. Not sure exactly what it does but it works! |
I've been having an issue for a while where some of the keys in maps are imported into Sass as their respective colour names, rather than a literal string. This is causing issues when trying to access them later with
map-get()
as you have to know if it was a colour name, or a string to do that.Suppose that I had the following JSON:
It would setup a map like this:
Where
primary
is a string, butred
is not. This adds all sorts of confusion due to the inconsistency in how the keys of the map are setup. Is it possible to force all keys to be strings? This might be a rather drastic breaking change, so perhaps it could exist behind an option?Thanks 👍
The text was updated successfully, but these errors were encountered: