nuxt-community / vuetify-module

Vuetify Module for Nuxt 2
Other
628 stars 106 forks source link

How to locally install material icons? #504

Closed ghost closed 2 years ago

ghost commented 2 years ago

EDIT: Solution (and a related workaround to the issue I was having) found here. No need to load it as a plugin, as I tried to do.

https://github.com/nuxt-community/vuetify-module/issues/496#issuecomment-1077542323


Hi. How can you locally install the mdi icons? I don't want to use a CDN.

I tried by following the Vuetify instructions and applying the process to a plugin format

  1. npm install @mdi/font -D

  2. /plugins/material-icons.js:

import '@mdi/font/css/materialdesignicons.css'
import Vue from 'vue'
import Vuetify from 'vuetify/lib'

Vue.use(Vuetify)

export default new Vuetify({
  icons: {
    iconfont: 'mdi'
  }
})
  1. nuxt.config.js:
plugins: [
    { src: '~plugins/material-icons.js' }
  ],

It seems to half-work, but vuetify wants to strictly use ?v=6.7.96 (notice that both local and CDN are in use)

image

NPM installed the correct version, but it's still trying to use the CDN font.

$ npm list | grep mdi
├── @mdi/font@6.7.96