git - 使用vue项目部署到github页面的问题

标签 git github vue.js github-pages

我正在尝试将 vue-cli 项目部署到 github 页面,我按照本网站和 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/

Setting -> source -> master /docs

have a /docs folder in the root of the repository

not follow the repository naming scheme username.github.io or orgname.github.io

这是我的存储库:https://github.com/leewei05/blog

但是结果一直给我404,还是不知道我的问题是什么,求助!

最佳答案

原来我的配置路径错误,这里是将新的 vue-cli 项目部署到 git hub 页面的步骤。

(你得先安装npm和vue-cli)

  1. $ vue init webpack [项目名称]
  2. $ cd [项目名称]
  3. $ npm install
  4. 转到您的 config/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
  }
  1. $ npm run build
  2. 将其推送到您的 github 存储库
  3. 转到存储库中的设置
  4. 找到您的 GitHub 页面部分并将来源更改为 '大师' -> '大师/文档'
  5. 你的页面应该在 https://[userName].github.io/[repositoryName]/#/
  6. 祝你好运!

关于git - 使用vue项目部署到github页面的问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47615863/

相关文章:

Coda 应用程序的 Git 集成

git - Chef 不会从 git checkout 开发分支

git pull 和 push 特定文件而不存储库保存在本地

github - 将现有存储库添加为 GitHub Pages 上的页面

html - 文件无法编辑 Github 页面

javascript - VueJS 自定义 Prop 验证功能

Git - 如果我想拥有一致的工作流程,那么 cherry-pick 是一种不好的做法吗?

Git - 在一个存储库下管理多个项目

javascript - yarn 构建 - 崩溃错误 JavaScript 堆内存不足

javascript - 如何在 Vue 中的渲染列表中打开模式?