2013-11-20 91 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