mirror of
https://github.com/wahyd4/vuepress.git
synced 2026-08-15 16:25:52 +10:00
1.6 KiB
1.6 KiB
Deploying
The following guides assumes you are placing your docs inside the docs directory of your project and using the default build output location.
GitHub Pages
-
Set correct
basein.vuepress/config.js.If you are deploying to
https://<USERNAME>.github.io/, you can omitbaseas it defaults to"/".If your are deploying to
https://<USERNAME>.github.io/<REPO>/, (i.e. your repository is athttps://github.com/<USERNAME>/REPO>), setbaseto"/<REPO>/". -
Inside your project, create
deploy.shwith the following content (with highlighted lines uncommented appropriately) and run it to deploy:
::: tip You can also run this script in your CI setup to enable automatic deployment on each push. :::
#!/usr/bin/env sh
# abort on errors
set -e
# build
vuepress build docs
# navigate into the build output directory
cd docs/.vuepress/dist
# if you are deploying to a custom domain
# echo 'www.example.com' > CNAME
git init
git add -A
git commit -m 'deploy'
# if you are deploying to https://<USERNAME>.github.io
# git push -f git@github.com:<USERNAME>/<USERNAME>.github.io.git master
# if you are deploying to https://<USERNAME>.github.io/<REPO>
# git push -f git@github.com:<USERNAME>/<REPO>.git master:gh-pages
cd -
Netlify
- Make sure you have npm scripts for building your docs:
{
"scripts": {
"docs:build": "vuepress build docs"
}
}
- On Netlify, setup up a new project from GitHub with the following settings:
- Build Command:
npm run docs:buildoryarn docs:build - Publish directory:
docs/.vuepress/dist
- Hit the deploy button!