这是我的代码,我想在我的sass文件中创建mixins
=shaping($height , $width, $rad, $bg, $color)
height: $height
width: $width
-webkit-border-radius: $rad
-moz-border-radius: $rad
-ms-border-radius: $rad
background-color: $bg
border-radius: $rad
color: $color
但是当我编译它时会出现这个错误,并且我不知道问题是什么,任何人都可以帮助我吗?是因为语法吗?
error: properties are only allowed within rules, directives, mixin includes or other properties
答案 0 :(得分:2)
=shaping($height, $width, $rad, $bg, $color)
height: $height
width: $width
-webkit-border-radius: $rad
-moz-border-radius: $rad
-ms-border-radius: $rad
border-radius: $rad
background-color: $bg
color: $color
.element
+shaping(50px, 50px, 10px, #000, #fff)
选择后,给出一个换行符。例如。
.element
+shaping
答案 1 :(得分:0)
下面的代码对我有用:
$brand-dark: #000
$brand-light: #fff
=shaping($height , $width, $rad, $bg, $color)
height: $height
width: $width
-webkit-border-radius: $rad
-moz-border-radius: $rad
-ms-border-radius: $rad
background-color: $bg
border-radius: $rad
color: $color
.box
+shaping(120px, 100px, 10%, $brand-dark, $brand-light)