2014-07-20 3 views
0

"SCSS"로 쓰여진 mixin이 좋았습니다."와"지시문을 쓰는 방법

@mixin absolute($args) { 
    $offsets: top right bottom left; 
    @each $o in $offsets { 
     $i: index($args, $o); 

     @if $i 
     and $i + 1 <= length($args) 
     and type-of(nth($args, $i + 1)) == number { 
      #{$o}: nth($args, $i + 1); 
     } 
    } 
} 

그리고 "sass"로 변환합니다. 하지만, 그것은 오류가

=absolute($args) 
$offsets: top right bottom left 
@each $o in $offsets 
    $i: index($args, $o) 
    @if $i 
    and $i + 1 <= length($args) 
    and type-of(nth($args, $i + 1)) == number 
     #{$o}: nth($args, $i + 1) 

... 내가 쓰기 "와" "사스"지시문 방법을

Invalid CSS after "and ": expected selector, was "$i + 1 <= lengt..." 

?

답변

1

이것이 작동하는지 확인하십시오. 내가 한 모든 것은 and을 같은 줄에 넣었습니다.

=absolute($args) 
$offsets: top right bottom left 
@each $o in $offsets 
    $i: index($args, $o) 
    @if $i and $i + 1 <= length($args) and type-of(nth($args, $i + 1)) == number 
     #{$o}: nth($args, $i + 1) 
+0

고맙습니다! 나는 그것을 얻었다!! –