aboutsummaryrefslogtreecommitdiff
path: root/sass/_font-extend.sass
blob: 35f7a50005515ceae050966534d59b2463459377 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
@use "sass:meta"
@use "variables"    	as var
@use "function/font"	as f

$findFont-Main	: null	!default
$findFont-Code	: null	!default
$fontExt-Main 	: null	!default
$fontExt-Code 	: null	!default

$typeMain	: meta.type-of($fontExt-Main)
$typeCode	: meta.type-of($fontExt-Code)

@if ($typeMain == 'string') or ($typeMain == 'list')
  @if ($findFont-Main == null) // prepend
    var.$font        : f.font-prepend(var.$font, $fontExt-Main)
  @else                       // append
    $iFoundFont-Main : index(var.$font     , $findFont-Main)
    @if $iFoundFont-Main
      var.$font      : f.font-append( var.$font, $fontExt-Main, $findFont-Main)
    @else
      @debug "⚠ Failed to find font '#{$findFont-Main}' in the list of '#{var.$font}'"

@if ($typeMain == 'string') or ($typeMain == 'list')
  @if ($findFont-Code == null) // prepend
    var.$font-mono        : f.font-prepend(var.$font-mono, $fontExt-Code)
  @else                       // append
    $iFoundFont-Code : index(var.$font-mono     , $findFont-Code)
    @if $iFoundFont-Code
      var.$font-mono      : f.font-append( var.$font-mono, $fontExt-Code, $findFont-Code)
    @else
      @debug "⚠ Failed to find font '#{$findFont-Code}' in the list of '#{var.$font-mono}'"

@mixin font-root
  #{--ff}: var.$font
  #{--fm}: var.$font-mono //code