3

I have about 50 mixins, all generate certain things, however, I want to make one mixin, which calls any of them by a name, rather than making a giant chained if statement, I was wondering if there's a way to call a mixin by a name, example:

@mixin getKeyframes($name, $options) {
    @include #{$name}($options);
}

Let's say I have a mixin called fadeIn

@mixin fadeIn($options) {
    // Do something here
}

And Now I want to use the getKeyframes mixin to call fadeIn

@include getKeyFrames(fadeIn, true);

Something like that?

Shannon Hochkins
  • 11,763
  • 15
  • 62
  • 95
  • possible duplicate of [Sass Interpolation challenge](http://stackoverflow.com/questions/16152547/sass-interpolation-challenge) – cimmanon Mar 31 '14 at 03:20
  • Related: http://stackoverflow.com/questions/17181849/placeholder-mixin-scss-css – cimmanon Mar 31 '14 at 03:22

1 Answers1

0

Currently there isn't a way to do this is SASS 3.3.4, it is being proposed for future versions of SASS. The syntax for how to do this hasn't been decided yet and that is why it wasn't implemented in sass 3.3. To stay up to date on the conversation see this github issue https://github.com/nex3/sass/issues/626

tjbenton
  • 71
  • 2