将Vue项目部署到Github Page上

我的原创地址:https://dongkelun.com/2019/06/04/vueDeployGithubPages/

前言

本文讲如何将Vue项目的dist文件夹部署到Github Page上,目的是可以在线访问前端效果,这样不需要自己购买服务器,当然任何静态文件夹都可以这样做,不止局限于Vue

操作步骤

1、首先在Git上建立一个项目,如vue-echarts-map


2、然后将本地项目push到远程master (非必须)

echo "# vue-echarts-map" >> README.md
git init
git add README.md
git commit -m "first commit"
git remote add origin https://github.com/dongkelun/vue-echarts-map.git
git push -u origin master

3、主要是下面这一步,将打包后的dist文件夹push到gh-pages

npm run build
git checkout -b gh-pages
git add -f dist
git commit -m 'first commit'
git subtree push --prefix dist origin gh-pages

这样就可以直接在浏览器查看效果了http://gh.dongkelun.com/vue-echarts-map

备注:1、我这里做了域名绑定 dongkelun.github.io=>gh.dongkelun.com 没有域名的直接访问http://dongkelun.github.io/vue-echarts-map
2、还有首先你先创建一个类似yourgithubname.github.io这样格式的GitHub仓库,然后按上面把dist文件夹(即静态文件夹)push到gh-pages分支,就会自动部署了。
域名绑定只需在dongkelun.github.io仓库做一次即可,即加一个CNAME,然后域名加解析,这里不做详细说明~
3、如果你不用gh-pages分支,或者你不想分享源代码,你可以直接将dist文件夹push到master分支,但是需要自己在Setting里设置,用哪个分支部署,默认是gh-pages分支
如echarts-map

参考:如何在 GitHub Pages 上部署 vue-cli 项目

每日英语

  • 1、binomial adj. 二项式的;双名的,二种名称的 n. 二项式;双名词组,二种名称;成对词
  • 2、multinomial adj. 多项的 n. 多项式
  • 3、outcome n. 结果,结局;成果
  • 4、variant 变量(variate) n. 变体;转化 adj. 不同的;多样的
  • 5、Elastic Net 弹性网络 机器学习算法与Python实践(9) - 弹性网络(Elastic Net) Elastic net regularization

Logistic regression is a popular method to predict a categorical response. It is a special case of Generalized Linear models that predicts the probability of the outcomes. In spark.ml logistic regression can be used to predict a binary outcome by using binomial logistic regression, or it can be used to predict a multiclass outcome by using multinomial logistic regression. Use the family parameter to select between these two algorithms, or leave it unset and Spark will infer the correct variant.
以下为谷歌浏览器翻译:
逻辑回归是预测分类响应的常用方法。广义线性模型的一个特例是预测结果的概率。在spark.ml逻辑回归中,可以使用二项逻辑回归来预测二元结果,或者可以使用多项逻辑回归来预测多类结果。使用该family 参数在这两种算法之间进行选择,或者保持不设置,Spark将推断出正确的变量。

你可能感兴趣的:(将Vue项目部署到Github Page上)