-rw-r--r-- readme.rst
1 minify-fontawesome - pelican plugin 2 =================================== 3 4 minify-fontawesome is a plugin for the `pelican 5 <https://github.com/getpelican/pelican>`_ static site generator that copies 6 fontawesome fonts and css into your output folder, *excluding* those that are 7 not found in your site. 8 9 If you only use a small number of icons it can reduce fontawesome CSS from 10 ~70KB to ~5KB, and fonts from ~90KB to ~2KB. 11 12 At the end of site generation, the plugin identifies which icons are being used 13 and copies the CSS and font definitions of these icons into 14 *output_path/static/css/fa.css* and *output_path/static/webfonts/* 15 respectively. 16 17 To enable, `download fontawesome <https://fontawesome.com/download>`_ and set 18 this variable in your pelicanconf.py to the path where fontawesome is saved 19 (for example): 20 21 .. code-block:: python 22 23 MINIFY_FONTAWESOME = '/home/user/fontawesome-free-5.11.2-web' 24 25 Fontforge must be installed, and is available in many linux distribution 26 repositories. 27 28 Much like with normal fontawesome usage, the CSS file should be linked in html 29 headers, i.e. put this into page templates: 30 31 .. code-block:: html 32 33 <link rel="stylesheet" href="{{ SITEURL }}/theme/css/fa.css"/> 34 35 36 Additional icons 37 ---------------- 38 39 Additional icons that aren't found in your articles can be added using a list 40 of their corresponding CSS references and this variable name: 41 42 .. code-block:: python 43 44 FONTAWESOME_EXTRA = ['fa-rss', 'fa-poo-storm'] 45 46 47 RST roles 48 --------- 49 50 This plugin also adds 3 small RST roles that can be used to include font 51 awesome icons in RST drafts: 52 53 .. code-block:: RST 54 55 Here is a solid icon :fas:`blender-phone` 56 Here is a regular icon :far:`meh-rolling-eyes` 57 Here is a brand icon :fab:`github` 58 59 60 Troubleshooting 61 --------------- 62 63 If you are writing using the local devserver and new fonts are not showing in 64 your draft, your browser has likely cached an older version of the generated 65 font. Many browsers have a way to force a refresh of all requests, including 66 fonts, which will fix this. In Firefox this is Ctrl-F5 instead of just F5 to 67 refresh. 68 69 This plugin has only been tested with fontawesome-free-5.11.2-web so far. 70 71 72 Contact 73 ------- 74 75 Email me @ mcol@posteo.net for questions or contributions. 76