Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/haskell/10.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Fonts Sass Mixin可选参数_Fonts_Sass_Mixins - Fatal编程技术网

Fonts Sass Mixin可选参数

Fonts Sass Mixin可选参数,fonts,sass,mixins,Fonts,Sass,Mixins,我在下面写这封信: =font-placeholder($location, $name, $fallback: '', $fallback-style: '') %#{$location}-font font-family: "#{$name}", "#{$fallback}", $fallback-style +font-placeholder($location: body, $name: FontName) 而不是输出以下内容: %body-font { font-f

我在下面写这封信:

=font-placeholder($location, $name, $fallback: '', $fallback-style: '')
  %#{$location}-font
    font-family: "#{$name}", "#{$fallback}", $fallback-style

+font-placeholder($location: body, $name: FontName)
而不是输出以下内容:

%body-font {
  font-family: "FontName", "", "";
我希望它输出以下内容:

%body-font {
  font-family: "FontName";

有什么帮助吗?

如果字符串不需要引号,请不要引用它。那你以后就不必取消报价了

您需要的是字体列表,这样您就不必担心额外的逗号或空字符串

=font-placeholder($location, $fonts...)
  %#{$location}-font
    font-family: $fonts

+font-placeholder(body, FontName)
+font-placeholder(body, FontName, serif)
+font-placeholder(body, FontName, Arial, sans-serif)
应该生成如下内容:

%body-font {
  font-family: FontName;

%body-font {
  font-family: FontName, serif;

%body-font {
  font-family: FontName, Arial, sans-serif;