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 Add Reusable Logic to Your Sass Write Loops with @for

How to properly include an if statement inside a for loop in sass?

.

1 Answer

Hi

The reason it is not working is because you have compiler errors in your scss.

1.

Problem

Compilation Error
Error: required parameters must precede optional parameters
        on line 170 of sass/c:\dev\workspace\app\tes\test.scss
>> @mixin links($text-dec: none, $color, $font-weight: null) {

solution - required params first

@mixin links($color, $text-dec: none, $font-weight: null)

2.

problem

Compilation Error
Error: You may not @extend an outer selector from within @media.
       You may only @extend selectors within the same directive.
       From "@extend %grid" on line 121 of sass/c:\dev\workspace\app\tes\test.scss
        on line 110 of sass/c:\dev\workspace\app\tes\test.scss
>> %grid {

Solution - extend within a mixin

@mixin test {
    @extend %grid;
}

.grid__col--#{$number}.theme__colors {
    @include test;
}