Munter / subfont

Command line tool to optimize your webfont loading. Aggressive subsetting based on your font use, self-hosting of Google fonts and preloading
MIT License
1.56k stars 29 forks source link

[Feature Request] Option to just optimize fonts, nothing else. #156

Open the-hotmann opened 2 years ago

the-hotmann commented 2 years ago

My website is finished and should stay as it is. Just the font should be optimized.

ATM my command is:

yarn subfont -rs --formats='woff2,woff' public/index.html -o test/

(--formats='woff2,woff' to prevent #155 since if multiple formats are given they are not getting inlined into the CSS as base64 encodes.)

it creates a copy of my whole "public" folder and optimizes the fonts for ALL the included static pages. But at the end I just need the fonts, nothing more! I then write the woff2 back to the public folder.

All this overhead would not be needed. Therefore I would really like to have a "--just-fonts" option.

Overall (with #155) my command should look like this:

yarn subfont --no-base64 --just-fonts -rsi --formats='woff2' public/index.html

(--formats='woff2' maybe not even needed as -i is active which stands for "inplace" and therefore should be the same format as started with since it gets overwritten.)

which then would crawl the whole page optimize the font for ALL pages and then write back just the two fonts and overwrite the old ones. That would be way easier then creating a "test" folder, which I (after writing all the overhead to) delete again.

That would be really cool. Thanks in advance and if I can assist in some way please let me know.

The idea behind this is, to be able to configurate the command in a way, that you in the end know, if you run that over a statically generated website the only things that will change are the font files itself. That would be a dream.

Not needing to write all the other stuff should speed up the process and create less overhead. Also it should be able to run "in-place" without affecting a lot of things like HTML, CSS, JS. But instead just the font files itself. I think that would be a very clean approach.