Pelican plugin to minify fontawesome assets to include used icons.
git clone https://github.com/m-col/pelican-minify-fontawesome
Files | Refs | Readme

Commit a5e9660092709115462c9ac5224881486def9dcf
Parent: 4bbf5e7eb952d08a813af71948711d33f1580a02
Author: mcol <mcol@posteo.net>
Date: 2019-10-13 23:18:19 +0100
Committer: mcol <mcol@posteo.net>
Committed: 2019-10-13 23:18:19 +0100

add readme and script-top license

readme.rst Added

@@ -0,0 +1,31 @@
+minify-fontawesome - pelican plugin
+===================================
+
+minify-fontawesome is a plugin for the `pelican
+<https://github.com/getpelican/pelican>`_ static site generator that extracts
+only icons used in your website from fontawesome source files upon site
+generation. If you only use a small number of icons it reduces served CSS from
+around 70KB to around 5KB.
+
+At the end of site generation, the plugin identifies which icons are being used
+and copies the CSS and font definitions of these icons into
+*output_path/static/css/fa.css* and *output_path/static/webfonts/*
+respectively.
+
+To enable, `download fontawesome <https://fontawesome.com/download>`_ and set
+this variable in your pelicanconf.py to the path where fontawesome is saved
+(for example):
+
+.. code-block:: python
+
+   MINIFY_FONTAWESOME = '/home/user/fontawesome-free-5.11.2-web'
+
+Fontforge must be installed, and is available in many linux distribution
+repositories.
+
+Much like with normal fontawesome usage, the CSS file should be linked in html
+headers, i.e. put this into page templates:
+
+.. code-block:: html
+
+    <link rel="stylesheet" href="{{ SITEURL }}/theme/css/fa.css"/>

minify_fontawesome.py Modified

@@ -1,22 +1,21 @@
 # -*- coding: utf-8 -*-
-"""
-minify-fontawesome - A plugin for the pelican static site generator that
-extracts only icons used in your website from fontawesome source files to
-copies them to the output folder to lighten served fontawesome files.
-
-To use, set MINIFY_FONTAWESOME in your pelican config to a locally downloaded
-fontawesome icon folder (e.g. '/home/user/fontawesome-free-5.11.2-web').
-
-These can be downloaded from https://fontawesome.com/download (the web fonts).
-
-It also requires that fontforge is installed.
-
-This will save the css file into output_path/static/css/fa.css, and fonts into
-output_path/static/webfonts/.
-
-To use it, something like this should be added to html headers:
-    <link rel="stylesheet" href="{{ SITEURL }}/theme/css/fa.css"/>
-"""
+#
+# pelican-minify-fontawesome
+# 
+# Copyright (C) 2019 mcol@posteo.net
+# 
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+# 
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+# 
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
 
 
 import fontforge as ff