Kcko
2/7/2019 - 2:05 PM

Bootstrap - font size utility classes

By me @Kcko

// ----
// libsass (v3.5.4)
// ----

@function to-string($value) {
  @return inspect($value);
}


/// Replace `$search` with `$replace` in `$string`
/// @author Hugo Giraudel
/// @param {String} $string - Initial string
/// @param {String} $search - Substring to replace
/// @param {String} $replace ('') - New value
/// @return {String} - Updated string
@function str-replace($string, $search, $replace: '') {
  $index: str-index($string, $search);

  @if $index {
    @return str-slice($string, 1, $index - 1) + $replace + str-replace(str-slice($string, $index + str-length($search)), $search, $replace);
  }

  @return $string;
}


$i: 0.1;

@while $i <= 4
{
  $iSafe: str-replace(to-string($i), '.', '_');
  .fs-#{$iSafe}
  {
    font-size: #{$i}rem;
  }
  
  $i: $i + 0.1;
}
.fs-0_1 {
  font-size: 0.1rem;
}

.fs-0_2 {
  font-size: 0.2rem;
}

.fs-0_3 {
  font-size: 0.3rem;
}

.fs-0_4 {
  font-size: 0.4rem;
}

.fs-0_5 {
  font-size: 0.5rem;
}

.fs-0_6 {
  font-size: 0.6rem;
}

.fs-0_7 {
  font-size: 0.7rem;
}

.fs-0_8 {
  font-size: 0.8rem;
}

.fs-0_9 {
  font-size: 0.9rem;
}

.fs-1 {
  font-size: 1rem;
}

.fs-1_1 {
  font-size: 1.1rem;
}

.fs-1_2 {
  font-size: 1.2rem;
}

.fs-1_3 {
  font-size: 1.3rem;
}

.fs-1_4 {
  font-size: 1.4rem;
}

.fs-1_5 {
  font-size: 1.5rem;
}

.fs-1_6 {
  font-size: 1.6rem;
}

.fs-1_7 {
  font-size: 1.7rem;
}

.fs-1_8 {
  font-size: 1.8rem;
}

.fs-1_9 {
  font-size: 1.9rem;
}

.fs-2 {
  font-size: 2rem;
}

.fs-2_1 {
  font-size: 2.1rem;
}

.fs-2_2 {
  font-size: 2.2rem;
}

.fs-2_3 {
  font-size: 2.3rem;
}

.fs-2_4 {
  font-size: 2.4rem;
}

.fs-2_5 {
  font-size: 2.5rem;
}

.fs-2_6 {
  font-size: 2.6rem;
}

.fs-2_7 {
  font-size: 2.7rem;
}

.fs-2_8 {
  font-size: 2.8rem;
}

.fs-2_9 {
  font-size: 2.9rem;
}

.fs-3 {
  font-size: 3rem;
}

.fs-3_1 {
  font-size: 3.1rem;
}

.fs-3_2 {
  font-size: 3.2rem;
}

.fs-3_3 {
  font-size: 3.3rem;
}

.fs-3_4 {
  font-size: 3.4rem;
}

.fs-3_5 {
  font-size: 3.5rem;
}

.fs-3_6 {
  font-size: 3.6rem;
}

.fs-3_7 {
  font-size: 3.7rem;
}

.fs-3_8 {
  font-size: 3.8rem;
}

.fs-3_9 {
  font-size: 3.9rem;
}

.fs-4 {
  font-size: 4rem;
}