Skip to content

Commit

Permalink
chore!: migrate to @unhead/vue from @vueuse/head (antfu-collective#348)
Browse files Browse the repository at this point in the history
  • Loading branch information
sapphi-red authored Jun 29, 2023
1 parent e5314de commit c463b64
Show file tree
Hide file tree
Showing 16 changed files with 297 additions and 563 deletions.
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ Static-site generation for Vue 3 on Vite.
> **This library requires Node.js version >= 14**
<pre>
<b>npm i -D vite-ssg</b> <em>vue-router @vueuse/head</em>
<b>npm i -D vite-ssg</b> <em>vue-router @unhead/vue</em>
</pre>

```diff
Expand Down Expand Up @@ -48,7 +48,7 @@ export const createApp = ViteSSG(

### Single Page SSG

For SSG of an index page only (i.e. without `vue-router`); import `vite-ssg/single-page` instead, and only install `@vueuse/head` (`npm i -D vite-ssg @vueuse/head`).
For SSG of an index page only (i.e. without `vue-router`); import `vite-ssg/single-page` instead, and only install `@unhead/vue` (`npm i -D vite-ssg @unhead/vue`).

```ts
// src/main.ts
Expand All @@ -74,7 +74,7 @@ The `ClientOnly` component is registered globally when the app is created.

## Document head

From `v0.4.0` onwards, we ship [`@vueuse/head`](https://github.com/vueuse/head) to manage the document-head out of the box. You can use it directly in your pages/components.
We ship [`@unhead/vue`](https://unhead.harlanzw.com/integrations/vue/setup) to manage the document-head out of the box. You can use it directly in your pages/components.
For example:

```html
Expand All @@ -83,7 +83,7 @@ For example:
</template>

<script setup>
import { useHead } from '@vueuse/head'
import { useHead } from '@unhead/vue'
useHead({
title: 'Website Title',
Expand All @@ -99,7 +99,7 @@ useHead({

That's all! No configuration is needed. Vite SSG will automatically handle the server-side rendering and merging.

See [`@vueuse/head`'s docs](https://github.com/vueuse/head) for more usage information about `useHead`.
See [`@unhead/vue`'s docs](https://unhead.harlanzw.com/integrations/vue/setup) for more usage information about `useHead`.

## Critical CSS

Expand Down
3 changes: 2 additions & 1 deletion examples/multiple-pages-pwa/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
"serve": "vite preview"
},
"dependencies": {
"@unhead/vue": "^1.1.26",
"vue": "^3.2.47"
},
"devDependencies": {
Expand All @@ -16,7 +17,7 @@
"vite": "^4.2.1",
"vite-plugin-pages": "^0.29.0",
"vite-plugin-pwa": "^0.14.7",
"vite-plugin-vue-markdown": "^0.22.4",
"vite-plugin-vue-markdown": "^0.23.5",
"vite-ssg": "workspace:*",
"vue-router": "^4.1.6"
}
Expand Down
2 changes: 1 addition & 1 deletion examples/multiple-pages-pwa/src/pages/b.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<script lang="ts">
import { useHead } from '@vueuse/head'
import { useHead } from '@unhead/vue'
export default {
setup() {
Expand Down
2 changes: 1 addition & 1 deletion examples/multiple-pages-pwa/src/pages/index.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<script lang="ts">
import { useHead } from '@vueuse/head'
import { useHead } from '@unhead/vue'
export default {
setup() {
Expand Down
2 changes: 1 addition & 1 deletion examples/multiple-pages-pwa/src/pages/nested/deep/a.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<script lang="ts">
import { useHead } from '@vueuse/head'
import { useHead } from '@unhead/vue'
export default {
setup() {
Expand Down
3 changes: 2 additions & 1 deletion examples/multiple-pages-with-store/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
"serve": "vite preview"
},
"dependencies": {
"@unhead/vue": "^1.1.26",
"pinia": "^2.0.34",
"vue": "^3.2.47"
},
Expand All @@ -18,7 +19,7 @@
"unplugin-vue-components": "^0.24.1",
"vite": "^4.2.1",
"vite-plugin-pages": "^0.29.0",
"vite-plugin-vue-markdown": "^0.22.4",
"vite-plugin-vue-markdown": "^0.23.5",
"vite-ssg": "workspace:*",
"vue-router": "^4.1.6"
}
Expand Down
2 changes: 1 addition & 1 deletion examples/multiple-pages-with-store/src/pages/b.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<script lang="ts">
import { computed } from 'vue'
import { useHead } from '@vueuse/head'
import { useHead } from '@unhead/vue'
import { useRootStore } from '../store/root'
export default {
Expand Down
3 changes: 2 additions & 1 deletion examples/multiple-pages/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
"serve": "vite preview"
},
"dependencies": {
"@unhead/vue": "^1.1.26",
"vue": "^3.2.47"
},
"devDependencies": {
Expand All @@ -16,7 +17,7 @@
"unplugin-vue-components": "^0.24.1",
"vite": "^4.2.1",
"vite-plugin-pages": "^0.29.0",
"vite-plugin-vue-markdown": "^0.22.4",
"vite-plugin-vue-markdown": "^0.23.5",
"vite-ssg": "workspace:*",
"vue-router": "^4.1.6"
}
Expand Down
2 changes: 1 addition & 1 deletion examples/multiple-pages/src/pages/b.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<script lang="ts">
import { useHead } from '@vueuse/head'
import { useHead } from '@unhead/vue'
export default {
setup() {
Expand Down
2 changes: 1 addition & 1 deletion examples/single-page/src/App.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<script setup lang="ts">
import { useHead } from '@vueuse/head'
import { useHead } from '@unhead/vue'
import { useRootStore } from './store/root'
useHead({
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@
"release": "bumpp && npm publish"
},
"peerDependencies": {
"@vueuse/head": "^1.0.0",
"@unhead/vue": "^1.1.26",
"critters": "^0.0.16",
"vite": "^2.0.0 || ^3.0.0 || ^4.0.0",
"vue": "^3.2.10",
Expand Down Expand Up @@ -114,7 +114,7 @@
"@types/jsdom": "^21.1.1",
"@types/prettier": "^2.7.2",
"@types/yargs": "^17.0.24",
"@vueuse/head": "^1.1.23",
"@unhead/vue": "^1.1.26",
"bumpp": "^9.1.0",
"critters": "^0.0.16",
"eslint": "^8.38.0",
Expand Down
Loading

0 comments on commit c463b64

Please sign in to comment.