I have a series of font values like this (Command separated one line):
Yeseva+One, Yrsa, ...
I'm looking for a SED (Or other bash tool expression) for turn each value into line statements like this:
--font-yeseva-one: "Yeseva One";
--font-yrsa: "Yrsa";
Thoughts?
Just wanted to say thanks for all the great help with this and if anyone needs google fonts as CSS variables / properties they are all available here (MIT License): https://github.com/superfly-css/superfly-css-variables-fonts/blob/master/src/main/css/index.css
I'll also be providing utilities for using google fonts here: https://github.com/superfly-css/superfly-css-utilities-fonts
#!/bin/sh
variable="Abc, Def+Hola, Ghij"
IFS="[, ]"
for i in $variable
do
a=`echo "$i" | sed 's/\+/ /g'`
i=`echo "$i" | tr '[:upper:]' '[:lower:]' | sed 's/\+/\-/g'`
echo "--font-$i: \"$a\";"
done
Please check, I have checked it on my machine and it works fine!
Output:
--font-abc: "Abc";
--font-def-hola: "Def Hola";
--font-ghij: "Ghij";