Deploying

    • You are placing your docs inside the directory of your project;
    • You are using the default build output location (.vuepress/dist);
    • VuePress is installed as a local dependency in your project, and you have setup the following npm scripts:
    • Set correct base in docs/.vuepress/config.js.

    If you are deploying to https://<USERNAME>.github.io/, you can omit base as it defaults to "/".

    If you are deploying to , (that is your repository is at https://github.com/<USERNAME>/<REPO&gt;), set base to "/<REPO>/".

    • Inside your project, create deploy.sh with the following content (with highlighted lines uncommented appropriately) and run it to deploy:
    1. #!/usr/bin/env sh
    2. # abort on errors
    3. set -e
    4. # build
    5. npm run docs:build
    6. # navigate into the build output directory
    7. cd docs/.vuepress/dist
    8. # if you are deploying to a custom domain
    9. # echo 'www.example.com' > CNAME
    10. git init
    11. git add -A
    12. git commit -m 'deploy'
    13. # if you are deploying to https://<USERNAME>.github.io
    14. # if you are deploying to https://<USERNAME>.github.io/<REPO>
    15. # git push -f git@github.com:<USERNAME>/<REPO>.git master:gh-pages
    16. cd -

    TIP

    You can also run the above script in your CI setup to enable automatic deployment on each push.

    • Set correct base in docs/.vuepress/config.js.

    If you are deploying to or GROUP>.github.io/, you can omit as it defaults to "/".

    If you are deploying to https://<USERNAME or GROUP>.github.io/<REPO>/, (that is your repository is at ;), set base to "/<REPO>/".

    • Create a file named .travis.yml in the root of your project.

    • Run yarn or npm install locally and commit the generated lockfile (i.e. yarn.lock or package-lock.json).

    • Use GitHub Pages deploy provider template and follow the travis documentation.

    1. language: node_js
    2. node_js:
    3. - lts/*
    4. install:
    5. - yarn install # npm ci
    6. script:
    7. - yarn docs:build # npm run docs:build
    8. deploy:
    9. provider: pages
    10. skip_cleanup: true
    11. local_dir: docs/.vuepress/dist
    12. github_token: $GITHUB_TOKEN # A token generated on GitHub allowing Travis to push code on you repository. Set in the Travis settings page of your repository, as a secure variable
    13. keep_history: true
    14. on:
    15. branch: master

    GitLab Pages and GitLab CI

    • Set correct base in docs/.vuepress/config.js.

    If you are deploying to https://<USERNAME or GROUP>.gitlab.io/<REPO>/, (that is your repository is at ;), set base to "/<REPO>/".

    • Set dest in .vuepress/config.js to public.

    • Create a file called .gitlab-ci.yml in the root of your project with the content below. This will build and deploy your site whenever you make changes to your content.

    Netlify

    • On , setup up a new project from GitHub with the following settings:

    • Build Command: yarn docs:build or

    • Publish directory: docs/.vuepress/dist

    • Hit the deploy button!

    1. {
    2. "hosting": {
    3. "public": "./docs/.vuepress/dist",
    4. "ignore": []
    5. }
    6. }

    .firebaserc:

    1. {
    2. "projects": {
    3. "default": "<YOUR_FIREBASE_ID>"
    4. }
    5. }
    • After running yarn docs:build or npm run docs:build, deploy with the command firebase deploy.

    Surge

    • First install surgeDeploying - 图4, if you haven’t already.

    • Run yarn docs:build or npm run docs:build.

    • Deploy to surge, by typing surge docs/.vuepress/dist.

    You can also deploy to a by adding surge docs/.vuepress/dist yourdomain.com.

    • First install Heroku CLIDeploying - 图6.

    • Create a Heroku account .

    • Run heroku login and fill in your Heroku credentials:

    • Create a file called static.json in the root of your project with the content below:

    static.json:

    1. {
    2. "root": "./docs/.vuepress/dist"
    3. }
    • Set up your Heroku git remote:
    1. # version change
    2. git init
    3. git add .
    4. git commit -m "My site ready for deployment."
    5. # creates a new app with a specified name
    6. heroku apps:create example
    7. # set buildpack for static sites
    • Deploying Your Site

    Now

    Please check out .