Proper Way To Add Fonts To Sage 9 Theme

  1. There is a Sage 9.x update branch that fixes lots of build issues:
    Sage "9.1": Please test

  2. When you host the font yourself you will want to minify and subset the font files.
    When you are using different weights and variants of the same font you should try to use a so called variable font, which is well-supported now.

  3. It is possible to add a webpack-loader for font files but I found it much easier to optimize the font files once and then use webpack copy to just copy them over to dist. There is already stuff copied in webpack, so you just have to duplicate that code in the webpack js and adjust the glob (regexp) so it matches font files.

1 Like