-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathstyleguide.config.js
75 lines (74 loc) · 2.01 KB
/
styleguide.config.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
const path = require('path');
const { version } = require('./package.json');
module.exports = {
title: 'rm-components',
version,
exampleMode: 'expand',
pagePerSection: false,
components: '../src/components/[A-Z]**/[A-Z]*.js*', // index.js
// ignore: ['**/src/test.js'],
webpackConfig: {
module: {
rules: [
{
test: /\.(js|jsx|mjs)?$/,
exclude: /node_modules/,
loader: 'babel-loader',
},
{
test: /\.scss$/,
use: ['style-loader', 'css-loader'],
},
],
},
},
require: [path.join(__dirname, 'styleguide.setup.js')],
updateExample(props, exampleFilePath) {
const { settings, lang } = props;
if (settings && typeof settings.file === 'string') {
const filepath = path.resolve(path.dirname(exampleFilePath), settings.file);
const { file, ...restSettings } = settings;
const rawContent = fs.readFileSync(filepath, 'utf8');
const content =
filepath.endsWith('.md') && lang === 'jsx' ? markdownToCodeExample(rawContent) : rawContent;
return {
content,
settings: restSettings,
lang,
};
}
return props;
},
assetsDir: 'static',
styleguideComponents: {
Wrapper: path.join(__dirname, 'src/Provider.js'),
},
sections: [
{
name: 'Brand',
components: 'src/components/brand/*.js*',
},
{
name: 'Icons',
components: 'src/components/icons/*.js*',
ignore: [
'src/components/icons/index.js',
'src/components/icons/IEdit.jsx',
'src/components/icons/IEx.jsx',
'src/components/icons/IInfo.jsx',
'src/components/icons/ITrash.jsx',
'src/components/icons/iconlib.js',
],
},
{
name: 'Primitives',
components: 'src/components/primitives/*.js*',
ignore: ['src/components/primitives/Option.jsx'],
},
{
name: 'Patterns',
components: 'src/components/patterns/*.js*',
ignore: ['src/components/patterns/Theme.jsx'],
},
],
};