Keyframes in SCSS

0

I have a mixin but applying it to an element does not apply correctly.

MixS SCSS

@mixin keyframes($property) {

    @-webkit-keyframes $property {
        @content;
    }

    @-moz-keyframes $property {
        @content;
    }

    @-o-keyframes $property {
        @content;
    }

    @keyframes $property {
        @content;
    }
}

Adding mixin to element

li:hover > ul {

            @include keyframes(animation) {
                0% {
                    color: #f8d2c0;
                }

                100% {
                    display: inherit;
                }
            }

And the result gives it to me like this

@-moz-keyframes $property
    
asked by qwerty 30.12.2018 в 17:01
source

1 answer

1

You must use Interpolación: #{$var}

Example:

@mixin keyframes($property) {

  @-webkit-keyframes #{$property} {
    @content;
  }

  @-moz-keyframes #{$property} {
    @content;
  }

  @-o-keyframes #{$property} {
    @content;
  }

  @keyframes #{$property} {
    @content;
  }
}
    
answered by 30.12.2018 / 17:30
source