Skip to content

Commit ba67e91

Browse files
committed
Add guidance on nuxt prerenderer
1 parent beb3c3f commit ba67e91

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

content/1.get-started/15.using-govuk-vue-with-nuxt.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,28 @@ export default defineNuxtConfig({
5252
})
5353
```
5454

55+
### Using static assets with Nuxt's prerenderer
56+
57+
If you're using Nuxt's prerenderer to generate a static site with `nuxt generate`, the prerenderer will not pick up these assets, so
58+
you will need to copy them into the output directory afterwards. You can use the [copyfiles](https://github.com/calvinmetcalf/copyfiles#readme)
59+
package for this:
60+
61+
```sh
62+
npm install copyfiles --save-dev
63+
```
64+
65+
Add a script to your `package.json` which runs `copyfiles` after `nuxt generate` - for example:
66+
67+
```json
68+
"generate": "nuxt generate && npx copyfiles -V -u 3 \".nuxt/dist/server/assets/**\" \".output/public\""
69+
```
70+
71+
You can then generate your static site with
72+
73+
```sh
74+
npm run generate
75+
```
76+
5577
## Update your HTML template
5678

5779
The main installation guide describes [changes you should make to your HTML template](/get-started/installing-govuk-vue#update-your-html-template).

0 commit comments

Comments
 (0)