Sass Keyframes animation mixin generating invalid CSS

后端 未结 2 916
南旧
南旧 2020-12-11 17:19

I have the following keyframes mixin, but it seems to be generated invalid CSS:

@mixin keyframes($animationName)
{
    @-webkit-keyframes $animationName {
           


        
2条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2020-12-11 17:52

    Same as above with prefixes:

    @mixin keyframes($animationName) {
      @-webkit-keyframes #{$animationName} {
        $browser: '-webkit-' !global;
        @content;
      }
      @-moz-keyframes #{$animationName} {
        $browser: '-moz-' !global;
        @content;
      }
      @-o-keyframes #{$animationName} {
        $browser: '-o-' !global;
        @content;
      }
      @keyframes #{$animationName} {
        $browser: '' !global;
        @content;
      }
    } $browser: null;
    

    Full details here.

    Or just use Autoprefixer instead.

提交回复
热议问题