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 trialPavlo Kochubei
15,009 PointsError when using Sass Map function
Get an error when trying to unpack Sass map function.
// Colors
$fountain-blue : #52bab3;
$emerald : #5ece7f;
$sunglo : #e67678;
$coral : #ff784f;
$purple-majesty : #9289c3;
$scooter : #39add1;
//UI Colors
$ui-colors: (
default : $fountain-blue,
success : $emerald,
error: : $sunglo,
warning : $coral,
info: : $purple-majesty
);
@each $theme, $color in $ui-colors {
.btn--#{$theme} {
background-color: $color;
}
}
I get the following error:
error scss/_config.scss (Line 44: Invalid CSS after " error: ": expected expression (e.g. 1px, bold), was ": $sunglo,")
Any suggestions?
1 Answer
Chris Shaw
26,676 PointsHi Pavlo,
Your code is almost perfect, in your map you have two extra colon's which are sitting after error and info, simply remove the extra colon's and your @each
statement will start working.
$ui-colors: (
default : $fountain-blue,
success : $emerald,
error : $sunglo,
warning : $coral,
info : $purple-majesty
);
Happy coding!
Pavlo Kochubei
15,009 PointsPavlo Kochubei
15,009 PointsThank you! I guess I need a break:)
Chris Shaw
26,676 PointsChris Shaw
26,676 PointsYou're welcome