A Pelican plugin that minifies fontawesome css and fonts to include only used icons.
git clone https://mcol.xyz/code/pelican-minify-fontawesome
Log | Files | Refs | README

commit 7a07c40d6da2030e9ef1d3ce3ded5bf4f82eb756
parent 94d36eb5c5332e8e9a1b7ff93f39db139d4bbd1f
Author: mcol <mcol@posteo.net>
Date:   Tue, 15 Oct 2019 11:12:24 +0100

Select each glyph individually in each font

Diffstat:
Mminify_fontawesome.py | 22++++++++++++----------
1 file changed, 12 insertions(+), 10 deletions(-)

diff --git a/minify_fontawesome.py b/minify_fontawesome.py @@ -34,21 +34,23 @@ def copy_glyphs(source, dest, css_blocks): icons.append(match[0]) os.mkdir(dest) - icons = ['rss'] for root, dirs, files in os.walk(source): for f in files: if f.endswith('woff'): font = fontforge.open(os.path.join(root, f)) - try: - font.selection.select(("more",), *icons) - except ValueError: - font.close() - continue - - font.selection.invert() - font.clear() - font.generate(os.path.join(dest, f)) + selected = False + for icon in icons: + try: + font.selection.select(("more",), icon) + selected = True + except ValueError: + pass + + if selected: + font.selection.invert() + font.clear() + font.generate(os.path.join(dest, f)) font.close()