1

I use Nuxt with vuetify. And I would like to use google fonts. Unfortunately it is not possible to overwrite the default font Roboto with a main.styl file. The goal in the main.stly is to overwrite the vuetify styl. How is that possible that I overwrite everything with my font (also buttons). Thank you very much for your help

nuxt.config.js

{
    rel: 'stylesheet',
    href:
      'https://fonts.googleapis.com/css?family=Noto+Serif'
  }
css: [
'~/assets/style/app.styl',
'~/assets/style/main.styl'css:],

main.styl

body{
font-family: 'Noto Serif', serif;}

image 01

image 02

Thomas.H
  • 53
  • 1
  • 7

4 Answers4

1

Don't know if it is still relevant, but you can try the following:

In your nuxt.config.js:

vuetify: {
    customVariables: ['~/assets/variables.styl']
}

And in */assets/variables.styl:

$body-font-family = 'Noto Serif', serif
Igal
  • 5,833
  • 20
  • 74
  • 132
  • in nuxt.config.js, the attribute vuetify.treeShake must be explicitly set to true, else this won't work – lorenzo Sep 01 '22 at 09:27
1

snap of nuxt.config.js

In nuxt.config.js you can add as follows and it automatically takes from google fonts.

You do not have to specify the font in your scss files. It automatically does that for you.

0

This way it works for me: in app.styl, which you specify as entry-point for your styles:

$body-font-family = 'Ubuntu'
@require '~vuetify/src/stylus/main'
DreaMinder
  • 633
  • 4
  • 6
0

In your nuxt.config.js:

vuetify: {
    customVariables: ['~/assets/variables.scss'],
    treeShake: true, // IMPORTANT! Else the default variables won't be overwritten
}

In your assets/variables.scss:

$body-font-family: 'FontName', sans-serif !default;

Linking any documentation is useless because this part of the nuxt documentation is totally ambiguous and misses a lot of things.

lorenzo
  • 627
  • 8
  • 12