2013-02-13 84 views
1

嗨,我有這個sass mixin和id喜歡將其更改爲SCSS mixin im真的關閉任何人都可以幫忙嗎?將sass轉換爲scss

SASS 
=animate($name: fadeIn, $duration: 1s, $delay: .2s, $function: ease, $mode: both) 
    +experimental(animation, $name $duration $delay $function $mode) 

What iv done so far in SCSS 
@mixin animate($name, $duration, $delay, $function, $mode) { 
animation: { 
    name: $name; 
    duration: $duration; 
    delay: $delay; 
    function: $function; 
    mode: $mode; 
} 
} 
+1

如果你只是希望SASS和SCSS語法之間進行切換,有一個命令行工具,帶有薩斯會爲你做它:'青菜-convert filename.sass filename.scss'(或'sass-convert filename.scss filename.sass')。 – cimmanon 2013-02-13 20:16:29

回答

0

我在想這就是你想要做的。

MIXIN:

@mixin animate($name, $duration, $delay, $function, $mode) { 
    name: $name; 
    duration: $duration; 
    delay: $delay; 
    function: $function; 
    mode: $mode; 
} 

INCLUDE:

// SELECTOR TO ADD ANIMATION TO 
.animation { 
    @include animate(fadein, 1s, .2s, ease, both); 
} 
0

SCSS =

@mixin animate($name, $duration, $delay, $function, $mode) { 
    name: $name; 
    duration: $duration; 
    delay: $delay; 
    function: $function; 
    mode: $mode } 

.animation { 
    @include animate(fadein, 1s, .2s, ease, both) } 

CSS =

.animation { 
    name: fadein; 
    duration: 1s; 
    delay: 0.2s; 
    function: ease; 
    mode: both; } 
-2

你可以試試這個:

@mixin animate($name: fadeIn, $duration: 1s, $delay: 0.2s, $function: ease, $mode: both) { 
    @include experimental(animation, $name $duration $delay $function $mode); 
} 
+0

不要碰舊的問題,除非你有一些有意義的添加。這個答案不會增加現有的答案,也不會按原樣編譯。 – cimmanon 2016-02-16 12:53:19