I would like to describe my current situation and what I think would be cool if Hugo could do. I like websites fast, that’s why I go for SSG’s and for web optimization. On my latest journey I reached the limit of what I was capable of doing but didn’t wanted to give up, thats why I am here now.
I like fonts slim and clean, no unneeded overhead and other stuff. There are also currently a lot of programs and tools available to automatically subset fonts, but for all of them you need to provide a list, or array of characters which you want to keep at the end, basically which forms the subset.
And that’s where the problem is. I think a static subset does not make sense, as the content might (hopefully) change and the subset would not match anymore. This results in: the subset must be calculated:
- on each change
- for each font separately
I could solve the first problem, since I can simply run a script that gets all characters from a HTML document, but I fail at the second requirement since all these characters are not getting use on ALL of my fonts.
In fact, I have a font, just for headlines. They obviously contain a very small character list, while the font for content does have a way bigger characterlist.
So the issue for me right now is that I have no way of passing an array of HTML to a program/script which then just outputs me all used fonts and their perfect, minimal character list.
Like:
$ hugo -charList
{
"Poppins":"0123456789ÄÖÜABCDEFGHIJKLMNOPQRSTUVWXYZäöüabcdefghijklmnopqrstuvwxyz-,.&§ß?!©",
"Montserrat":"ÄACDEFHIKLMOPSTVWXYZäöüabcefghjklmnorstvxyz§"
}
something like this. Which would mean, Hugo crawls through all “.html” files and combines all the character lists eg. creates a global valid character list for each font.
I thought this maybe also would be a nice feature if Hugo could (while building the pages) crawl through them and check for character lists and in the end subset fonts, or at least output the character list used for each font.
Happy to discuss about this topic.
Thanks in advance.