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!

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


Urmilla Kannuswamy
Urmilla Kannuswamy
1,146 Points

Error while writing mixin for common text pattern

@mixin text { @mixin text($size, $l-height:null, $weight:null, $color:null) { font-size : $size; line-height : $l-height; font-weight : $weight; color : $color;
} }

I wrote this mixin and included the '_mixin.scss' file in the '_base.scss' file. @include text(1em, 1.5, $color:$color-text-base);

I got an error: Mixins may not be defined within control directives or other mixins.

Am i missing something?

1 Answer

David Bath
David Bath
25,940 Points

It looks like a syntax error because you have @mixin text inside @mixin text. You define a mixin like this:

@mixin text($size, $l-height:null, $weight:null, $color:null) {


Remove the outer @mixin text and you should be fine.