Skip to content

Instantly share code, notes, and snippets.

@ZaneMeroff
Last active September 13, 2021 20:32
Show Gist options
  • Save ZaneMeroff/3214e68bc9a4079cb064a95a099e1291 to your computer and use it in GitHub Desktop.
Save ZaneMeroff/3214e68bc9a4079cb064a95a099e1291 to your computer and use it in GitHub Desktop.

For Vue create a new file in your project root named vue.config.js (Docs) and specify the publicPath (Docs).

NOTE if using a custom subdomain like http://project-name.your-domian.com change publicPath to '/'

module.exports = {
  publicPath: '/name-of-your-project/'
}
  1. Now commit and push your changes and run npm run build

Note: if you don't commit your changes, you will lose them in the next command, so make sure you don't skip this step

Note: For the following commands, if you are using vue, just copy paste them, if you are using react replace dist with build.

  1. npm run build creates a directory with a production build of your app. In vue, that directory in named dist.

  2. git checkout --orphan gh-pages

  3. npm run build

  4. git --work-tree dist add --all

  5. git --work-tree dist commit -m 'Deploy'

  6. git push origin HEAD:gh-pages --force

  7. rm -r dist

  8. git checkout -f master

  9. git branch -D gh-pages

  10. Navigate to your github project and click 'Settings'

  11. Scroll to find the section 'Github Pages' , select the gh-pages branch and click 'Save'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment