2013-11-20 26 views
-1

此代碼:SCSS:代碼邊遠身體

//test.scss 
@import "imageColor"; 

body { 
    $sourceFile: resources/icon/mask; 
    $targetFile: resources/compass/images/icon; 
    $color: red;  
    @include createMask($sourceFile, $targetPath, $color);      
} 

而這個代碼不工作:

//test:scss 
@import "imageColor"; 

$sourceFile: resources/icon/mask; 
$targetFile: resources/compass/images/icon; 
$color: red;  
$buttonResult: createMask($sourceFile, $targetPath, $color); 

你知道爲什麼嗎?我需要將這些代碼發佈到身體{}之外。

+0

如果沒有某種選擇器,您希望編譯什麼CSS? – KatieK

+0

可能重複[在現有的Mixin上使用SASS函數?](http://stackoverflow.com/questions/15011527/using-sass-function-on-an-existing-mixin) – cimmanon

回答

1

嘗試

body { 
     @include createMask($sourceFile, $targetPath, $color);      
} 

更換

$buttonResult: createMask($sourceFile, $targetPath, $color); 

線恐怕你不能跳過體{}完全。沒有提及選擇器就不能應用樣式

+0

也許他需要針對不同的選擇器像html或*。 – KatieK

+0

可能。我只是寫了body,因爲這是他在問題的第一部分代碼中寫的。 – tewathia