Using nuxt fonts to set different fonts for specific CSS classes works perfectly for single-level classes, but when trying to apply a font to nested CSS classes, it does not load as expected.
For example, Lato works fine for .lato, but Nunito fails to apply in nested elements like .nunito p:
<template>
<div class="lato">
'Lato works!'
<div class="nunito">
<p>'Nunito does not work :('</p>
</div>
</div>
</template>
<style scoped>
.lato {
font-family: 'Lato';
}
.nunito {
p {
font-family: 'Nunito';
}
}
</style>
Reproduction steps
Apply a font family using nuxt fonts to a nested CSS class selector.
Note that the font only applies to single-level selectors, not nested ones like .nunito p.
Expected behaviour
Both fonts should be applied according to the CSS structure, with Lato on the outer div and Nunito on the inner <p> element.
Description
Using nuxt fonts to set different fonts for specific CSS classes works perfectly for single-level classes, but when trying to apply a font to nested CSS classes, it does not load as expected.
For example, Lato works fine for
.lato
, but Nunito fails to apply in nested elements like.nunito p
:Reproduction steps
Expected behaviour
Both fonts should be applied according to the CSS structure, with
Lato
on the outerdiv
andNunito
on the inner<p>
element.Reproduction link
Stackblitz repro