Issue
Standalone font loader doesn't load custom marketsans font files, if @font-face definitions are not available in the parent page.
Context
- eBay Inc., uses the widget platform that attempts to load
market-sans font via the stand alone loader present in this repo.
- Only if the parent page makes uses of
ebay-font module, via their page rendered marko templates, in the <head/> section, the marketsans definitions from @ebay/Skin gets stamped.
- If the page doesn't use this module, then, the stand-alone loader attempts to load the marketsans font files, but as the associated definitions via
@font-face rules are not available, the custom font doesn't get downloaded, yet it adds an entry into the localstorage thereby also preventing future downloads.
Possible Solve:
Create a style element via JS and append it to the <head/> & Inline the market-sans definitions in it & before triggering the downloads. As this anyway happens via font-display: optional, after window load, this would most likely prevent FOUT and FOIT.
If the suggested solve looks okay, lmk & i'll open a PR. Thx!
@RajaRamu @senthilp
Issue
Standalone font loader doesn't load custom
marketsansfont files, if@font-facedefinitions are not available in the parent page.Context
market-sansfont via the stand alone loader present in this repo.ebay-fontmodule, via their page rendered marko templates, in the<head/>section, themarketsansdefinitions from@ebay/Skingets stamped.@font-facerules are not available, the custom font doesn't get downloaded, yet it adds an entry into thelocalstoragethereby also preventing future downloads.Possible Solve:
Create a style element via JS and append it to the
<head/>& Inline the market-sans definitions in it & before triggering the downloads. As this anyway happens viafont-display: optional, after window load, this would most likely prevent FOUT and FOIT.If the suggested solve looks okay, lmk & i'll open a PR. Thx!
@RajaRamu @senthilp