qinshenxue / vue-icon

Maybe it is the smallest vue component that contains all the feather icons
https://qinshenxue.github.io/vue-icon/
MIT License
54 stars 12 forks source link

Nuxt Support #15

Closed bhaskar-nair2 closed 3 years ago

bhaskar-nair2 commented 3 years ago

How do I use this as a Nuxt plugin?

dvns commented 3 years ago

How do I use this as a Nuxt plugin?

/plugins/vueIcon.js

import Vue from 'vue'
import feather from 'vue-icon'
Vue.use(feather, 'v-icon')

nuxt.config.js

export default {
  // ...
  plugins: [
    { src: '~/plugins/vueIcon.js' },
  ],
  build: {
    transpile: ['vue-icon'],
  },
  // ...
};

You can then use the component in any vue template without needing to import:

<template>
  <div>
     <v-icon name="arrow-up" />
  </div>
</template>