diff options
| author | eugenesvk | 2023-05-03 23:07:56 +0700 |
|---|---|---|
| committer | Jieiku | 2023-05-22 23:05:03 -0700 |
| commit | 236919b4e6ce0c144ca4d5f12ab96a90de2042c2 (patch) | |
| tree | 8beb8b33cde2f578b80945abb96728094497b0a2 /sass/_font-extend.sass | |
| parent | e2aa6c47fd0e244060c4e4e7941bd7998664c4ce (diff) | |
| download | abridge-236919b4e6ce0c144ca4d5f12ab96a90de2042c2.tar.gz abridge-236919b4e6ce0c144ca4d5f12ab96a90de2042c2.tar.bz2 abridge-236919b4e6ce0c144ca4d5f12ab96a90de2042c2.zip | |
Update font-extend to include font-prepend
Diffstat (limited to 'sass/_font-extend.sass')
| -rw-r--r-- | sass/_font-extend.sass | 42 |
1 files changed, 28 insertions, 14 deletions
diff --git a/sass/_font-extend.sass b/sass/_font-extend.sass index d0a9361..35f7a50 100644 --- a/sass/_font-extend.sass +++ b/sass/_font-extend.sass @@ -1,20 +1,34 @@ +@use "sass:meta" @use "variables" as var @use "function/font" as f -$findFont-Main : "Segoe UI" !default -$findFont-Code : "Segoe UI Mono" !default -$fontExt-Main : ("MAIN FONT 1", "MAIN FONT 2") !default -$fontExt-Code : ("CODE FONT 1", "CODE FONT 2") !default -$iFoundFont-Main : index(var.$font , $findFont-Main) -$iFoundFont-Code : index(var.$font-mono, $findFont-Code) -@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 $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}'" +$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 |
