aboutsummaryrefslogtreecommitdiff
path: root/sass/function/_font.sass
diff options
context:
space:
mode:
authoreugenesvk2023-05-03 22:15:49 +0700
committerJieiku2023-05-22 23:03:51 -0700
commit2ee8b03aaed15435dc261a5caa398d0dfc96bb41 (patch)
tree26583205b790aae2ba56ee8b1e188938dd57313c /sass/function/_font.sass
parent2d7b05b0809f17af27d07e2789fe219645b9e525 (diff)
downloadabridge-2ee8b03aaed15435dc261a5caa398d0dfc96bb41.tar.gz
abridge-2ee8b03aaed15435dc261a5caa398d0dfc96bb41.tar.bz2
abridge-2ee8b03aaed15435dc261a5caa398d0dfc96bb41.zip
Add font-append function
Diffstat (limited to 'sass/function/_font.sass')
-rw-r--r--sass/function/_font.sass19
1 files changed, 19 insertions, 0 deletions
diff --git a/sass/function/_font.sass b/sass/function/_font.sass
new file mode 100644
index 0000000..c2b1165
--- /dev/null
+++ b/sass/function/_font.sass
@@ -0,0 +1,19 @@
+@use "sass:meta"
+@use "sass:list"
+
+@function font-append($base, $ext, $font-sep)
+ $base-pre : ()
+ $base-pos : ()
+ $iFontSep : index($base, $font-sep)
+ @if not $iFontSep // didn't find the font separator, return
+ @debug "⚠ Failed to find '#{$font-sep}' in the list of '#{$base}'"
+ @return $base
+
+ @for $i from 1 through list.length($base)
+ $iEl: list.nth($base, $i)
+ @if $i <= $iFontSep
+ $base-pre: list.append($base-pre, $iEl, $separator:comma)
+ @else
+ $base-pos: list.append($base-pos, $iEl, $separator:comma)
+
+ @return list.join(list.join($base-pre, $ext), $base-pos)