Css 多参数转换混合

Css 多参数转换混合,css,stylus,Css,Stylus,我只想为转换实现一个基本的mixin,这是我的代码: transition() transition arguments -webkit-transition arguments 在我将此mixin与单个属性一起使用之前,一切都正常工作,但当我尝试这样做时: a transition(color 1s, text-shadow 1s) 我的输出是: a { transition: color 1s text-shadow 1s; -web

我只想为转换实现一个基本的mixin,这是我的代码:

transition()
    transition         arguments
    -webkit-transition arguments
在我将此mixin与单个属性一起使用之前,一切都正常工作,但当我尝试这样做时:

a
   transition(color 1s, text-shadow 1s)
我的输出是:

a {
    transition: color 1s text-shadow 1s;
    -webkit-transition: color 1s text-shadow 1s;   
}
没有添加逗号。。。有什么建议吗?

请尝试以下方法:

trans = color 1s, text-shadow 1s

a
    transition(trans)
我对此的输出是:

a {
  transition: color 1s, text-shadow 1s;
  -webkit-transition: color 1s, text-shadow 1s;
}

只需删除括号即可自动解决问题:

a
    transition color 1s, text-shadow 1s

下面是一个简单的转换@mixin,它接受两个参数

@mixin transition($arg1, $arg2) {
  -webkit-transition: $arg1, $arg2;
  -moz-transition:    $arg1, $arg2;
  -ms-transition:     $arg1, $arg2;
  -o-transition:      $arg1, $arg2;
  transition:         $arg1, $arg2;
}
您的声明块将是:

@include transition(background .3s, color .3s);
CSS输出:

  -webkit-transition: background 0.3s, color 0.3s;
  -moz-transition: background 0.3s, color 0.3s;
  -ms-transition: background 0.3s, color 0.3s;
  -o-transition: background 0.3s, color 0.3s;
  transition: background 0.3s, color 0.3s;

除了两个参数之外,我建议用一个函数重构@mixin。

你的解决方案也可以,但我觉得我的解决方案更简洁,+1@cl0udw4lk3r的解决方案确实是正确的,但在我的情况下,它不起作用,我认为我的网站上发生了一些奇怪的事情。这个解决方案为我解决了这个问题,谢谢Alexey