fonts icon indicating copy to clipboard operation
fonts copied to clipboard

Fonts discovered in bundle generation don't generate preload tags

Open danielroe opened this issue 1 year ago • 0 comments

@danielroe

It seems the preload-tag is not generated for fonts, that are defined in tailwind.config.ts.

I define my font in tailwind-config like this:

	theme: {
		fontFamily: {
			body: ['"Felipa"', ...defaultTheme.fontFamily.sans],
		},
	},

And then set this css inside assets/css/tailwind.css:

  html {
    @apply font-body;
  }

Basically, nuxt/fonts is correctly picking up and downloading this font with everything seemingly working correctly, but it does not create the preload-tag.

Here is a stackblitz: https://stackblitz.com/edit/nuxt-starter-xrzkqs?file=app.vue

If you add this to app.vue, the preload-tag gets added correctly:

<style scoped>
div {
  font-family: Felipa, serif;
}
</style>

Originally posted by @codeflorist in https://github.com/nuxt/fonts/issues/24#issuecomment-2100275278

danielroe avatar May 08 '24 10:05 danielroe