SCSSのミックスインを作成しています。引数に応じて、追加の値を追加できることを知りたいです。これは私が試したことです。すべてが機能しますが、@ if条件:
@mixin fontFace( $fontName, $path: "", $weight: normal, $style: none, $fileName: $fontName, $svg:0 ) {
@font-face {
font-family: $fontName;
src: url("#{$path}#{$fileName}.eot");
src: url("#{$path}#{$fileName}.eot?iefix") format("eot"),
url("#{$path}#{$fileName}.woff") format("woff"),
url("#{$path}#{$fileName}.ttf") format("truetype")
@if $svg != 0 {
, url("#{$path}#{$fileName}.svg##{$fileName}") format("svg");
}else{
;
}
font-weight: $weight;
font-style: $style;
}
}