matthiasott / eleventy-plus-vite

A clean and fast Eleventy Starter Project with Vite
https://eleventyplusvite.netlify.app
MIT License
193 stars 31 forks source link

fonts are not used on any page. #18

Closed aloxe closed 1 month ago

aloxe commented 1 month ago

I am wondering why are the fonts so precisely separated in subset/extended woff files, preloaded with critical FOFT strategy and are not used anywhere in the styles. The only font-family call in the css is:

body {
    font-family: sans-serif;
}

As a result, the font is loaded because of FOTF but not applied on the page.

KiwiKilian commented 1 month ago

The fonts are used as soon as the classes are applied, just below the line you are referencing: https://github.com/matthiasott/eleventy-plus-vite/blob/main/src/assets/css/2-design-tokens/_fonts.scss#L52-L57

aloxe commented 1 month ago

Oh I see, the critical FOFT in base.njk adds fonts-loaded-1 and fonts-loaded-2 classes to the html tag.