0

sass I want to use that function

@function baseFontSize($vw : .05vw, $coef : 1){
    $return : calc((10px + #{$vw}) * #{$coef});
    @return $return;
}

I call it in that way

font-size: baseFontSize();
or
font-size: baseFontSize(1vw);
or
font-size: baseFontSize(1vw, 1.2);

but what if I want to keep the first argument as is and set only the second one ?

font-size: baseFontSize(default, 1.2);  ?

how can I do it ?

thanks

Erick Boileau
  • 478
  • 4
  • 14

1 Answers1

0

how about this.

@function baseFontSize($vw : .05vw, $coef : 1) {
  @if ($vw == ''){
    $vw : 0.5vw;
  }
  @if ($coef=='') {
    $coef: 1;
  }
  $return : calc((10px + #{$vw}) * #{$coef});
  @return $return;
}


.test1{
  font-size: baseFontSize();
}
.test2{
  font-size: baseFontSize( '',1.5 );
}
.test3{
  font-size: baseFontSize( .08vw,'' );
}
Evan Kim
  • 1
  • 1