-
Notifications
You must be signed in to change notification settings - Fork 464
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
@each with maps #492
Comments
Right. In Sass 3.3 we added generic support for destructuring assignment in
In general Sass supports |
Is it worth adding a separate bug for this case? These two use cases would likely be two separate patches to libsass. Also the current test sass/sass-spec#54 only cover the maps use case. |
@xzyfer I added those tests to the spec. Well, I made a pull request — if that looks good I (or someone else) can merge it in. |
Awesome @ericam thanks! |
Done. |
So, is this feature now implemented in the master branch? |
It appears that the only things that were merged in were the test cases for the bug. The milestone is set for 3.1 and 3.0 is only at release candidate at this time. I'd assume all 3.0 bugs are to be wrapped up before anything else is really looked at. The reality seems to be SOON™ though. |
If maps are supposed to be a key feature of 3.0, I'd love to see this make the cut. Looping isn't an edge case or a bonus feature — it's central to most map uses I've seen (and certainly any library use). There's a lot of excitement around 3.0, and I'd like to jump on that bandwagon, but none of my libraries can do much without looping through maps. Pretty please. :) |
I agrees $map: (foo: bar, bar: baz);
// before
@each $k, $v in $map {
// ...
}
// after
@each $k in map-keys($map) {
$v: map-get($map, $k);
// ...
} FWIW IMHO the more critical issue with maps is their performance (#536). I've dropped my work on feature queries (#261) and reference combinator (#452) to focus on map performance. |
@xzyfer Without sass-list-maps, i have an error with your solution:
|
Can you please post the code you used to get that error @andreasisaak ? |
@xzyfer I tested exactly your code :) |
@andreasisaak hmm I'm not sure why you'd get that error, can you please create a sassmeister gist for me to debug? Here is my PoC https://gist.github.com/xzyfer/adff8699236bd470afbd |
Any array map I try to create gives me an error like: error: error reading values after... Like: |
Sounds like you might be running libsass 2.0. Map support was added in 3.0. |
Hmmm. I'm using grunt, and grunt-sass, and I did an "npm update" in my project. How can I check my libsass version? |
grunt-sass added libsass 3.0 in version 0.16.0. Check the version in node_modules/grunt-sass/package.json and node_modules/node-sass/package.json |
@xzyfer It was my fault! The code works perfectly |
No worries @andreasisaak. Glad you got it sorted. I'm currently working on bring this to libsass. |
It looks like maps functionality was finally pulled in :). I was excited to finally use it, but
I'm assuming that
@each
hasn't been updated to support$key, $value
like in the 3.3 release blog example.The text was updated successfully, but these errors were encountered: