feat: add support for useHead (#122)

* feat: add support for `useHead`

* chore: use sigma@75

Co-authored-by: Pooya Parsa <pyapar@gmail.com>
This commit is contained in:
Daniel Roe 2021-01-20 19:17:36 +00:00 committed by GitHub
parent 8e320f80aa
commit 3f99bb7878
2 changed files with 15 additions and 0 deletions

View File

@ -1,8 +1,10 @@
import head from 'nuxt/app/plugins/head'
import router from 'nuxt/app/plugins/router'
import vuex from 'nuxt/app/plugins/vuex'
import legacy from 'nuxt/app/plugins/legacy'
export default [
head,
router,
vuex,
legacy

View File

@ -0,0 +1,13 @@
import type { Plugin } from 'nuxt/app'
import { createHead, renderHeadToString } from '@vueuse/head'
export default <Plugin> function head (nuxt) {
const { app, ssrContext } = nuxt
const head = createHead()
app.use(head)
if (process.server) {
ssrContext.head = () => renderHeadToString(head)
}
}