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 | |
| 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')
| -rw-r--r-- | sass/_font-extend-COPY-ME.sass | 3 | ||||
| -rw-r--r-- | sass/_font-extend.sass | 42 |
2 files changed, 31 insertions, 14 deletions
diff --git a/sass/_font-extend-COPY-ME.sass b/sass/_font-extend-COPY-ME.sass index f1f6262..658ebbd 100644 --- a/sass/_font-extend-COPY-ME.sass +++ b/sass/_font-extend-COPY-ME.sass @@ -4,11 +4,14 @@ // copy this file to your 'sass' folder: // either: remove the leading '_' and add 'font-extend-COPY-ME.css' to your 'stylesheets' in 'config.toml' // or : import it with '@use "_font-extend-COPY-ME"' in whatever existing sass file you already load + +// delete the following two lines if you want to prepend your fonts... $findFont-Main : "Segoe UI" // ← append custom MAIN font(s) AFTER this (full list @ '_variables.scss') $findFont-Code : "Segoe UI Mono" // ← append custom CODE font(s) AFTER this $fontExt-Main : ("MAIN FONT 1", "MAIN FONT 2") // list of custom MAIN font(s) to append $fontExt-Code : ("CODE FONT 1", "CODE FONT 2") // list of custom CODE font(s) to append +// ...and delete the corresponding variables ↓ @use "../themes/abridge/sass/font-extend" with($findFont-Main:$findFont-Main, $findFont-Code:$findFont-Code,$fontExt-Main:$fontExt-Main,$fontExt-Code:$fontExt-Code) // check ↑ relative path if you copy this file to some other location 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 |
