[Doc] optimize document site (#1013)

This commit is contained in:
neverland
2018-05-08 08:27:52 +08:00
committed by GitHub
parent 883fb78f21
commit 072dc24656
8 changed files with 51 additions and 85 deletions
+2 -20
View File
@@ -28,6 +28,7 @@ const install = Vue => {
});
};
/* istanbul ignore if */
if (typeof window !== 'undefined' && window.Vue) {
install(window.Vue);
}
@@ -55,26 +56,7 @@ function buildDemoEntry() {
.map(name => `'${name}': asyncWrapper(r => require.ensure([], () => r(componentWrapper(require('./views/${name}'), '${name}')), '${name}'))`);
const content = `${tips}
import './common';
import progress from 'nprogress';
function asyncWrapper(component) {
return function(r) {
progress.start();
component(r).then(() => {
progress.done();
}).catch(() => {
progress.done();
});
};
}
function componentWrapper(component, name) {
component = component.default;
component.name = 'demo-' + name;
return component;
}
import { asyncWrapper, componentWrapper } from './common';
export default {
${demos.join(',\n ')}
+1 -5
View File
@@ -1,6 +1,5 @@
const path = require('path');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const MiniCssExtractPlugin = require('mini-css-extract-plugin')
const ProgressBarPlugin = require('progress-bar-webpack-plugin');
const isProduction = process.env.NODE_ENV === 'production';
const { VueLoaderPlugin } = require('vue-loader')
@@ -56,7 +55,7 @@ module.exports = {
{
test: /\.(css|postcss)$/,
use: [
MiniCssExtractPlugin.loader,
'style-loader',
'css-loader',
'postcss-loader'
]
@@ -88,9 +87,6 @@ module.exports = {
template: 'docs/src/index.tpl',
filename: 'examples.html',
inject: true
}),
new MiniCssExtractPlugin({
filename: isProduction ? '[name].[hash:8].css' : '[name].css'
})
]
};