2017-12-03 294 views
1

我想部署一个vue-cli项目到github页面,我按照本网站上的说明和github支持。使用vue项目部署到github页面的问题

delpoy VUE-CLI到github上的网页: https://medium.com/@mwolfhoffman/deploying-to-github-pages-with-vue-webpack-cli-5b2ba17f14a0

配置的github页 https://help.github.com/articles/configuring-a-publishing-source-for-github-pages/

设置 - >源 - >主/文档

在根目录的/ docs文件夹的存储库

不遵循存储库命名方案username.github.io或orgn ame.github.io

这里是我的仓库:https://github.com/leewei05/blog

但结果一直给我404,仍然不知道我的问题,请大家帮忙!

回答

0

原来,我已经得到了错误的配置路径,这里是部署一个新VUE-CLI项目的Git枢纽页中的步骤。

(你得安装NPM和VUE-CLI第一)

  1. $ VUE的init的WebPack [项目]
  2. $ CD [项目]
  3. $ NPM安装
  4. 去你的配置/index.js文件
  5. 修改构建部分是这样的:

    build: { index: path.resolve(__dirname, '../docs/index.html'), assetsRoot: path.resolve(__dirname, '../docs'), assetsSubDirectory: 'static', assetsPublicPath: '', productionSourceMap: true, devtool: '#source-map', productionGzip: false, productionGzipExtensions: ['js', 'css'], bundleAnalyzerReport: process.env.npm_config_report }

  6. $ NPM运行建立

  7. 推到您的GitHub库
  8. 去设定在你的仓库
  9. 找到你的GitHub的网页部分,然后从 “主”更改源 - >“主/ docs'
  10. 您的页面应该位于'https://[userName].github.io/[repositoryName]/#/'
  11. 祝您好运!