Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

CSS

Lance Jeffers
seal-mask
.a{fill-rule:evenodd;}techdegree
Lance Jeffers
Full Stack JavaScript Techdegree Student 11,404 Points

"Error: Undefined Variable" in the map-get

I saw a previous student with the same issue but they never actually got an answer since they didn't post their code.

Here's my codepen (I just pasted the config and utilities into the same CSS area since I'm not sure how to do partials in Codepen):

https://codepen.io/lancej1022/pen/KjQgzp

The exact error I'm getting in VS Code is:

Error: Undefined variable. ╷ 16 │ @return map-get(map-get($palettes, $palette), $shade); │ ^^^^^^^^^ ╵ scss_utilities.scss 16:29 palette() scss_base.scss 26:12 @import scss\application.scss 5:9 root stylesheet

Lance Jeffers
seal-mask
.a{fill-rule:evenodd;}techdegree
Lance Jeffers
Full Stack JavaScript Techdegree Student 11,404 Points

One thing I noticed is that the error seems specific to VS Code and other IDEs -- when I paste the exact same code into the workspace I do not get any compiler errors. What would cause this??

1 Answer

Lance Jeffers
seal-mask
.a{fill-rule:evenodd;}techdegree
Lance Jeffers
Full Stack JavaScript Techdegree Student 11,404 Points

Turns out I answered my own questions (hopefully this helps other students who bump into the same issue).

After confirming that the exact same code compiled without error in the Treehouse Workspace, I went back to VS Code and stopped the sass --watch with Ctrl + C (Im on Windows). Once it stopped watching, I simply went back to my application.scss and started the watch again and this time it compiled perfectly fine.

Long story short, the issue appeared to be VS Code needing to "reboot" the watch command for some reason.