nuxt vuetify google fonts undefined
Using Google Fonts with Nuxt.js and Vuetify in a Vue Project
- Install the Required Packages
Run the following command to install the required packages:
bash npm install @nuxtjs/vuetify
Configure Vuetify
In the
nuxt.config.js
file, add the following configuration:javascript buildModules: [ '@nuxtjs/vuetify', ], vuetify: { customVariables: ['~/assets/variables.scss'], treeShake: true, },
Include Google Fonts in the Project
Inside the
<head>
section of thenuxt.config.js
file, add the following code to include Google Fonts:javascript head: { link: [ { rel: 'stylesheet', href: 'https://fonts.googleapis.com/css?family=Roboto:100,300,400,500,700,900' }, { rel: 'stylesheet', href: 'https://fonts.googleapis.com/css?family=Material+Icons' }, ], },
Usage in Vuetify Components
You can now use the Google Fonts in Vuetify components by specifying the font family in the styles or components where you want to apply them.
Verify and Test
- After making these changes, verify that the Google Fonts are successfully included and applied to the Vuetify components in your Vue project.