[Doc] deploy to github pages

This commit is contained in:
陈嘉涵 2018-05-28 18:49:41 +08:00
parent 155930192b
commit 0cde378373
6 changed files with 10 additions and 11 deletions

View File

@ -14,6 +14,10 @@ module.exports = {
publicPath: '/', publicPath: '/',
chunkFilename: 'async_[name].js' chunkFilename: 'async_[name].js'
}, },
stats: {
modules: false,
children: false
},
serve: { serve: {
open: true, open: true,
host: '0.0.0.0', host: '0.0.0.0',
@ -83,7 +87,7 @@ module.exports = {
new HtmlWebpackPlugin({ new HtmlWebpackPlugin({
chunks: ['vant-mobile'], chunks: ['vant-mobile'],
template: 'docs/src/index.tpl', template: 'docs/src/index.tpl',
filename: 'examples.html', filename: 'mobile.html',
inject: true inject: true
}) })
] ]

View File

@ -7,7 +7,7 @@ module.exports = Object.assign(config, {
mode: 'production', mode: 'production',
output: { output: {
path: path.join(__dirname, '../docs/dist'), path: path.join(__dirname, '../docs/dist'),
publicPath: 'https://img.yzcdn.cn/zanui/vant/', publicPath: 'https://youzan.github.io/vant/',
filename: '[name].[hash:8].js', filename: '[name].[hash:8].js',
chunkFilename: 'async_[name].[chunkhash:8].js' chunkFilename: 'async_[name].[chunkhash:8].js'
} }

View File

@ -11,9 +11,8 @@ import docConfig from './doc.config';
export default { export default {
data() { data() {
const path = location.pathname === '/' ? 'examples.html' : '/zanui/vant/examples';
return { return {
simulators: [`${path}${location.hash}`], simulators: [`mobile.html${location.hash}`],
demoURL: '' demoURL: ''
}; };
}, },

View File

@ -11,13 +11,12 @@ Vue.use(VueRouter).use(VantDoc);
const router = new VueRouter({ const router = new VueRouter({
mode: 'hash', mode: 'hash',
base: '/zanui/vant/',
routes: routes() routes: routes()
}); });
router.beforeEach((route, redirect, next) => { router.beforeEach((route, redirect, next) => {
if (isMobile) { if (isMobile) {
location.replace(location.pathname === '/' ? 'examples.html' : '/zanui/vant/examples' + location.hash); location.replace('mobile.html' + location.hash);
} }
progress.start(); progress.start();
document.title = route.meta.title || document.title; document.title = route.meta.title || document.title;

View File

@ -10,7 +10,6 @@ import './components/nprogress.css';
const router = new VueRouter({ const router = new VueRouter({
mode: 'hash', mode: 'hash',
base: '/zanui/vant/examples',
routes: routes(true) routes: routes(true)
}); });

View File

@ -18,12 +18,10 @@
"build:file": "node build/bin/build-entry.js", "build:file": "node build/bin/build-entry.js",
"build:components": "node build/bin/build-components.js --color", "build:components": "node build/bin/build-components.js --color",
"build:vant-css": "gulp build --gulpfile packages/vant-css/gulpfile.js --color", "build:vant-css": "gulp build --gulpfile packages/vant-css/gulpfile.js --color",
"build:vant": "cross-env NODE_ENV=production webpack --progress --hide-modules --color --config build/webpack.build.js && cross-env NODE_ENV=production webpack -p --progress --hide-modules --color --config build/webpack.build.js", "build:vant": "cross-env NODE_ENV=production webpack --color --config build/webpack.build.js && cross-env NODE_ENV=production webpack -p --color --config build/webpack.build.js",
"build:style-entry": "node build/bin/build-style-entry.js", "build:style-entry": "node build/bin/build-style-entry.js",
"build:changelog": "sh build/bin/build-changelog.sh", "build:changelog": "sh build/bin/build-changelog.sh",
"deploy": "npm run deploy:docs && npm run deploy:cdn && gh-pages -d docs/dist --remote youzan", "deploy": "rimraf docs/dist && cross-env NODE_ENV=production webpack --config build/webpack.doc.js && gh-pages -d docs/dist",
"deploy:cdn": "superman cdn /zanui/vant docs/dist/*.js",
"deploy:docs": "rimraf docs/dist && cross-env NODE_ENV=production webpack --progress --hide-modules --config build/webpack.doc.js",
"dist": "npm run bootstrap && node build/bin/build-lib.js", "dist": "npm run bootstrap && node build/bin/build-lib.js",
"lint": "./node_modules/.bin/eslint ./packages --ext .js,.vue", "lint": "./node_modules/.bin/eslint ./packages --ext .js,.vue",
"test": "jest", "test": "jest",