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 Sass Basics (retired) Advanced Sass Concepts Interpolating and if/else

Hani Aldar
Hani Aldar
1,397 Points

I wrote the @if/else but I've got this quoted error "The generated file needs to end with '.png'."

Hi, I wrote the @if/else but I've got this quoted error "The generated file needs to end with '.png'.."

Did I miss something in the code?!

1 Answer

I was able to get the challenge to pass. Did you write the code for the fourth stage underneath the code for the rest of the stages?

This code worked for me:

// first stage
@mixin cars($make, $color) {
  // second stage
  .#{$make} {
    border: 1px solid black;
    background-image: url("#{$color}.png"); // third stage
  }
}

// fourth stage
$time: morning;

a {
  @if $time == morning {
    color: red;
  }
  @else if $time == afternoon {
    color: blue;
  }
  @else {
    color: gray;
  }
}
Hani Aldar
Hani Aldar
1,397 Points

Thanks for your answer. Yes, I did.

Well, the second time I wrote the code, it told me that I've to define $time variable. the differences I made are: 1- $ time: "morning";

2- @if $time == "morning" { a {color: red;} } @else if $time == "afternoon" { a {color: blue;} } @else { a{color: gray;} }

Sorry about that; your answer should've passed. Glad to hear I could help!