-
Notifications
You must be signed in to change notification settings - Fork 23
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
how to add custom theme and icons in plugin #85
Comments
You should move a few things to
About Move css: ['@core/scss/template/libs/vuetify/index.scss', 'vuetify/styles'], // <== maybe requires changing the `@` prefix with `/` EDIT: remove your plugin or don't register Vuetify plugin inside it |
@userquin following code solved the issue , thanks btw :) import { createVuetify } from 'vuetify'
import defaults from './vuetify/defaults'
import { icons } from './vuetify/icons'
import theme from './vuetify/theme'
export default defineNuxtPlugin(( nuxtApp ) => {
nuxtApp.hook('vuetify:configuration', ({ vuetifyOptions }) => {
vuetifyOptions.theme = theme
vuetifyOptions.icons = icons
vuetifyOptions.defaults = defaults
})
const vueitfy = createVuetify()
nuxtApp.vueApp.use(vueitfy)
}) |
You're registering the Vuetify plugin twice, replace your Nuxt plugin with this one: import defaults from './vuetify/defaults'
import { icons } from './vuetify/icons'
import theme from './vuetify/theme'
export default defineNuxtPlugin(( nuxtApp ) => {
nuxtApp.hook('vuetify:before-create', ({ vuetifyOptions }) => {
vuetifyOptions.theme = theme
vuetifyOptions.icons = icons
vuetifyOptions.defaults = defaults
})
}) You can also move this configuration to your Nuxt/Vuetify config file, removing also your Nuxt plugin, the Vuetify module will register the Vuetify plugin for you. |
can you try adding empty EDIT: file a new issue for this 🙏 |
Problem StatementI wanted to migrate from my custom setup to this plugin, but I am having issues migrating the These are my current working Vuetify Options using import { aliases, mdi } from "vuetify/iconsets/mdi-svg"
import { mdiAutoFix, ... } from "@mdi/js"
const mdiIcons= {
mdiAutoFix,
// ..
}
const customIcons = {
wMedia: "M2 9.07228H3.44362C..."
// ..
}
//..
const options = {
// ..
icons: {
defaultSet: "mdi" ,
aliases: {
...aliases,
...customIcons,
...mdiIcons
},
sets: {
mdi,
},
}
} If I use the official defineNuxtConfig({
vuetify: {
vuetifyOptions: {
// all other options work, except "icons"
icons: {
defaultSet: "mdi-svg", // doesn't matter if i choose mdi-svg or mdi, same error
sets: ["mdi"],
svg: {
mdi: {
// produces TS errors, since the interfaces for `icons` is different than in the original vuetify config
...aliases,
...customIcons,
...mdiIcons
},
},
},
}
}) The above config, will lead to the following error when starting local nuxt server: Only workaround that works for meexport default defineNuxtPlugin((nuxtApp) => {
// using "vuetify:before-create" has the same issues as in `nuxt.config`. The icons interface is different.
nuxtApp.hook("vuetify:configuration", ({ vuetifyOptions }) => {
// other options can be defined in nuxt.config.ts, but I don't know if that has any downsides
vuetifyOptions.icons = myVuetifyOptions.icons
})
}) |
i have file of icons and custom theme which i want to include in plugin , how to do so ? i have following cod in plugin
The text was updated successfully, but these errors were encountered: