- Add
@nuxtclub/octicons
dependency to your project
npm i -D @nuxtclub/octicons
- Add
@nuxtclub/octicons
to thebuildModules
section ofnuxt.config.js
dependency
(No --dev
or --save-dev
flags) and use modules
section in nuxt.config.js
instead of buildModules
.
export default {
buildModules: ['@nuxtclub/octicons'],
}
Add the types to your "types"
array in tsconfig.json
after the @nuxt/types
entry.
@nuxt/vue-app
instead of @nuxt/types
for nuxt < 2.9.
{
"compilerOptions": {
"types": ["@nuxt/types", "@nuxtclub/octicons"]
}
}
This module will inject $octicons in the context of your application.
Using $octicons you can access to an object with all the icons of the Octicons Package.
<template>
<div v-html="$octicons['home'].toSVG()"></div>
</template>
Now you can also use the auto-imported component in your .vue
files.
<template>
<octicons name="home" size="64">
</template>
Learn more about Octicons here.