nuxt-community / electron-template

Electron starter with nuxt.js
MIT License
251 stars 31 forks source link

add plugins #6

Closed pucheta-adrian closed 7 years ago

pucheta-adrian commented 7 years ago

Hi, how to add plugins in nuxt.config.js? I am trying to add vuetify this. like this

module.exports = {
  /*
  ** Electron Settings
  */
  electron: {
    width: 1024,
    height: 768
  },
  build: {
    vendor: ['vuetify'],
    plugins: ['~plugins/vuetify.js'],
    head: {
      link: [
        { rel: 'stylesheet', href: 'https://fonts.googleapis.com/css?family=Roboto' },
        { rel: 'stylesheet', href: 'https://fonts.googleapis.com/icon?family=Material+Icons' }
      ]
    },
    extend (config, { isClient }) {
      // Extend only webpack config for client-bundle
      if (isClient) {
        config.target = 'electron-renderer'
      }
    }
  }
}
This question is available on Nuxt.js community (#c9)
detrohutt commented 7 years ago

@adrianrey05 Please see the Vue Plugins section of the Nuxt docs.

The plugins section of your nuxt.config.js should be beside the build section(that's for webpack settings), not inside of it. Also make sure you are importing and initializing vuetify in a file inside the plugins folder which needs to be next to your pages folder.