誰かが使用したい CSS プロパティ、プロパティの値、およびそれを必要とするベンダー (Opera、Mozilla、Firefox、Webkit、IE) を指定できるベンダー プロパティ用の Less mixin を作成しようとしています。 、 なし)。
私はもともと SASS here でコードを書きましたが、Less に移植するのに苦労しています。
これが私が現在持っているものです:
.vendor(@property, @value, @vendors...) {
.vendor-detect() when (@vendors = webkit) {
-webkit-@{property}: @value;
}
.vendor-detect() when (@vendors = moz) {
-moz-@{property}: @value;
}
.vendor-detect() when (@vendors = ms) {
-ms-@{property}: @value;
}
.vendor-detect() when (@vendors = o) {
-o-@{property}: @value;
}
.vendor-detect() when (@vendors = official) {
@{property}: @value;
}
.vendor-detect();
}
現在、コードを次のように使用する場合:
.button {
.vendor(border-radius, 4px, official);
}
あなたは得る:
.button {
border-radius: 4px;
}
しかし、ミックスインで複数のベンダーを宣言できるようにしたいので、次を使用します。
.button {
.vendor(border-radius, 4px, webkit moz official);
}
私に提供する必要があります:
.button {
-webkit-border-radius: 4px;
-moz-border-radius: 4px;
border-radius: 4px;
}
しかし、今はそうではありません。
vendors
では、この mixin でパラメーターをループするにはどうすればよいでしょうか。