Open Joldnine opened 6 years ago
用Vue开发网页,Webpack打包,部署到Github Pages.
$ vue init webpack my-github-page
$ cd my-github-page
$ npm install
config/index.js
build
assetsPublicPath
./
build/webpack.prod.conf.js
removeAttributeQuotes
false
$ npm run build
dist/
username.github.io
<username>.github.io
master branch
$ git clone { username.github.io的git link }
$ cd username.github.io $ git add . $ git commit -m "init" $ git push
最后,大概2分钟后,在浏览器上打开 https://username.github.io, 就可以看到你的网页了。
#!/bin/bash set -x BLOG_REPO="joldnine.github.io" BLOG_DEV="vuejs-blog" cd $BLOG_DEV npm run build >/dev/null cd .. rm -rf $BLOG_REPO/static rm -rf $BLOG_REPO/index.html cp -r $BLOG_DEV/dist/* $BLOG_REPO/ cd $BLOG_REPO git add . git commit -a -m "deploy" git push origin master
小阳棒棒哒!
用Vue开发网页,Webpack打包,部署到Github Pages.
1. 以vue的应用举例:用 vue-cli 初始一个空白webpack项目并打包成静态网页
$ vue init webpack my-github-page
$ cd my-github-page
$ npm install
config/index.js
build
module下的assetsPublicPath
为./
build/webpack.prod.conf.js
removeAttributeQuotes
为false
$ npm run build
生成静态页面,生成的文件在dist/
目录下2. 建一个Github Page
username.github.io
, 其中username要和自己github的username相同。<username>.github.io
repo下,进入Settings, 在GitHub Pages那栏下,Source选择master branch
.3. push 静态页面到repo
username.github.io
dist/
文件夹下所有文件到 username.github.io 文件夹下最后,大概2分钟后,在浏览器上打开 https://username.github.io, 就可以看到你的网页了。
自动化脚本