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 Interpolation and if/else Loops

Include Mixin inside Mixin

Can I inside mixin in other mixin? I have a mixin for radius and a mixin for prefixr and I need use de prefixr mixin first but inside put the radius. Is that posible?

Like:

@include prefixr({ @include radius(), value})

2 Answers

Hey Luis

You can do something like this...

@mixin a {
  mixin goes here
}
@mixin b {
  @include a();

  other stuff goes here
}

cheers

Kleo Petroff
Kleo Petroff
5,726 Points

Hi Matt, I can actually include a mixin without the parentheses. What is the better way of doing it - with or without them?

Hey Kleo

I would still include the brackets. Some mixins require variables and this would go between the brackets so its a good habit to get into.

For example mixin would be...

@mixin border-radius($radius) {
  border-radius: $radius;
}

and then include the mixin...

@include border-radius(10px);

cheers