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

Does it support SPA? #149

Closed AcrylicShrimp closed 3 years ago

AcrylicShrimp commented 3 years ago

Hello! First of all, thanks for this amazing work!

I'm going to use this to optimize my SPA application, and I'm wonder how do I use it.

  1. How do I specify multiple paths while using a single index.html? Is it possible? I'm going to use the --in-place option on my dist directory.
  2. Some of my pages emit ajax requests to get its content on-the-fly. Is there way to notify the subfont that the content is ready to serve via DOM event or something?

Thank you!

papandreou commented 3 years ago

How do I specify multiple paths while using a single index.html? Is it possible? I'm going to use the --in-place option on my dist directory.

No, that's not supported presently, sorry.

Some of my pages emit ajax requests to get its content on-the-fly. Is there way to notify the subfont that the content is ready to serve via DOM event or something?

Subfont does all its work at build time, so there's no runtime component to receive such a notification. Presently, only the content that's present in the static HTML (and on the initial load with the experimental --dynamic switch) will be traced out and included in the created subsets.

This means that subfont is definitely more well suited for static websites than SPAs. We've been thinking about some features that could still help with SPAs, though:

AcrylicShrimp commented 3 years ago

@papandreou Thanks for your quick response!