-
Notifications
You must be signed in to change notification settings - Fork 0
/
doczrc.js
77 lines (69 loc) · 1.76 KB
/
doczrc.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
/* eslint-disable import/no-extraneous-dependencies */
/* eslint-disable global-require */
import url from 'url';
import packageInfo from './package.json';
/**
* 获取基本URL
*/
function getBaseUrl() {
if (process.env.NODE_ENV === 'production') {
const { name, homepage } = packageInfo;
if (homepage) {
return url.parse(homepage).path;
}
if (name.startsWith('@')) {
return name.substr(name.indexOf('/'));
}
return `/${name}`;
}
return '/';
}
export default {
title: 'ripple',
codeSandbox: false,
typescript: true,
files: ['**/*.mdx'],
public: './docs/assets',
menu: ['首页'],
wrapper: 'docs/Wrapper.tsx',
indexHtml: 'docs/index.html',
base: getBaseUrl(),
onCreateWebpackChain: (config) => {
// 配置webpack的方式:[webpack-chain](https://github.com/neutrinojs/webpack-chain)
config.module
.rule('css')
.test(/\.css$/)
.use('style-loader')
.loader('style-loader')
.end()
.use('css-loader')
.loader('css-loader')
.options({
importLoaders: 1,
})
.end()
.use('postcss-loader')
.loader('postcss-loader')
.options({
plugins: (loader) => [
require('postcss-import')({ root: loader.resourcePath }),
require('postcss-preset-env')({
browsers: ['last 2 versions', 'not dead', 'IE 10', 'IE 11'],
}),
],
})
.end();
config
.plugin('ghpages')
.use(require('webpack-docz-ghpages-plugin'))
.end();
config.resolve
.plugin('tsconfig-paths')
.use(require('tsconfig-paths-webpack-plugin'))
.end();
config.watchOptions({
ignored: ['node_modules', 'dist', '.cache', 'coverage', '.docz']
});
return config;
},
};