font shorthand regex
I needed to replace shorthand declarations across a whole project and took a while writing the regex, so here it goes for later reference :
(font:) ([a-zA-Z]+) ((?:\d*\.)?\d+em)\/((?:\d*\.)?\d+em) (whatever font-families;)
which you can then replace with :
font-weight: $2;
font-size: $3;
line-height: $4;
font-family: $5
and then, for those without line-height :
(font:) ([a-zA-Z]+) ((?:\d*\.)?\d+em) ("whatever font-families;)
replace :
font-weight: $2;
font-size: $3;
font-family: $4
Written by jérémy saint-prix
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Css
Authors
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#