From 0cde3783731f776d75e5898e20963bcefedf9516 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=99=88=E5=98=89=E6=B6=B5?= Date: Mon, 28 May 2018 18:49:41 +0800 Subject: [PATCH] [Doc] deploy to github pages --- build/webpack.dev.js | 6 +++++- build/webpack.doc.js | 2 +- docs/src/DocsApp.vue | 3 +-- docs/src/index.js | 3 +-- docs/src/mobile.js | 1 - package.json | 6 ++---- 6 files changed, 10 insertions(+), 11 deletions(-) diff --git a/build/webpack.dev.js b/build/webpack.dev.js index 4f7e15b57..136aa24c6 100644 --- a/build/webpack.dev.js +++ b/build/webpack.dev.js @@ -14,6 +14,10 @@ module.exports = { publicPath: '/', chunkFilename: 'async_[name].js' }, + stats: { + modules: false, + children: false + }, serve: { open: true, host: '0.0.0.0', @@ -83,7 +87,7 @@ module.exports = { new HtmlWebpackPlugin({ chunks: ['vant-mobile'], template: 'docs/src/index.tpl', - filename: 'examples.html', + filename: 'mobile.html', inject: true }) ] diff --git a/build/webpack.doc.js b/build/webpack.doc.js index 239891bf8..3146723c2 100644 --- a/build/webpack.doc.js +++ b/build/webpack.doc.js @@ -7,7 +7,7 @@ module.exports = Object.assign(config, { mode: 'production', output: { path: path.join(__dirname, '../docs/dist'), - publicPath: 'https://img.yzcdn.cn/zanui/vant/', + publicPath: 'https://youzan.github.io/vant/', filename: '[name].[hash:8].js', chunkFilename: 'async_[name].[chunkhash:8].js' } diff --git a/docs/src/DocsApp.vue b/docs/src/DocsApp.vue index 6da044395..e5619a3a9 100644 --- a/docs/src/DocsApp.vue +++ b/docs/src/DocsApp.vue @@ -11,9 +11,8 @@ import docConfig from './doc.config'; export default { data() { - const path = location.pathname === '/' ? 'examples.html' : '/zanui/vant/examples'; return { - simulators: [`${path}${location.hash}`], + simulators: [`mobile.html${location.hash}`], demoURL: '' }; }, diff --git a/docs/src/index.js b/docs/src/index.js index 3d1235b27..b0dc5aa3d 100644 --- a/docs/src/index.js +++ b/docs/src/index.js @@ -11,13 +11,12 @@ Vue.use(VueRouter).use(VantDoc); const router = new VueRouter({ mode: 'hash', - base: '/zanui/vant/', routes: routes() }); router.beforeEach((route, redirect, next) => { if (isMobile) { - location.replace(location.pathname === '/' ? 'examples.html' : '/zanui/vant/examples' + location.hash); + location.replace('mobile.html' + location.hash); } progress.start(); document.title = route.meta.title || document.title; diff --git a/docs/src/mobile.js b/docs/src/mobile.js index bca50032e..73f77c000 100644 --- a/docs/src/mobile.js +++ b/docs/src/mobile.js @@ -10,7 +10,6 @@ import './components/nprogress.css'; const router = new VueRouter({ mode: 'hash', - base: '/zanui/vant/examples', routes: routes(true) }); diff --git a/package.json b/package.json index 0d0b3ea95..d9ebf65aa 100644 --- a/package.json +++ b/package.json @@ -18,12 +18,10 @@ "build:file": "node build/bin/build-entry.js", "build:components": "node build/bin/build-components.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:changelog": "sh build/bin/build-changelog.sh", - "deploy": "npm run deploy:docs && npm run deploy:cdn && gh-pages -d docs/dist --remote youzan", - "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", + "deploy": "rimraf docs/dist && cross-env NODE_ENV=production webpack --config build/webpack.doc.js && gh-pages -d docs/dist", "dist": "npm run bootstrap && node build/bin/build-lib.js", "lint": "./node_modules/.bin/eslint ./packages --ext .js,.vue", "test": "jest",