Allow initial setup in `createHead`
innocenzi opened this issue · comments
Describe the feature
When using @vueuse/head
, the following syntax was valid:
initializeHybridly({
enhanceVue: (vue) => {
vue.use(createFlare())
vue.use(createHead({
titleTemplate: (title) => title ? `${title} - Dashboard` : 'Dashboard',
}))
},
})
However, it is not anymore when using unhead/vue
. Could this be implemented back?
I wanted to PR, but due to the T = {} extends Head
generic, this required more changes than I wanted to do, so I preferred filing an issue instead.
Additional information
- Would you be willing to help implement this feature?
Hi, thanks for the issue. It wouldn't be possible to add support for it on the first root options.
Maybe something like
const head = createHead({
entry: { titleTemplate: (title) => title ? `${title} - Dashboard` : 'Dashboard' }
})
Is there a problem with doing it like this though? I'd personally prefer not to add more logic for this (adds to the package size).
initializeHybridly({
enhanceVue: (vue) => {
vue.use(createFlare())
const head = createHead()
head.push(titleTemplate: (title) => title ? `${title} - Dashboard` : 'Dashboard')
vue.use(head)
},
})
Your first suggestion is fine by me
The "problem" is not an actual problem, it's just quality of life, in my list of all 10 Vue plugins, this is the only one that requires multiple lines to configure, so it kind of breaks the flow. And since @vueuse/head
had the functionality, I thought we could add it back