forked from geops/trafimage-maps
-
Notifications
You must be signed in to change notification settings - Fork 0
/
styleguide.config.js
143 lines (142 loc) · 3.76 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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
/* eslint-disable import/no-extraneous-dependencies */
require('dotenv').config();
const path = require('path');
const webpack = require('webpack');
const { version } = require('./package.json');
module.exports = {
version,
template: {
favicon: 'img/favicon.png',
},
assetsDir: 'src/',
components: [],
styleguideDir: 'styleguide-build',
require: [
path.join(__dirname, 'src/styleguidist/styleguidist.css'),
'react-app-polyfill/ie11',
'react-app-polyfill/stable',
'@webcomponents/webcomponents-platform',
'@webcomponents/custom-elements',
'@webcomponents/webcomponentsjs/custom-elements-es5-adapter',
'proxy-polyfill',
],
ribbon: {
url: 'https://github.com/geops/trafimage-maps',
text: 'Fork me on GitHub',
},
moduleAliases: {
'trafimage-maps': path.resolve(__dirname, 'src'),
},
pagePerSection: true,
sections: [
{
name: 'Trafimage Maps',
content: 'src/examples/README.md',
exampleMode: 'expand',
sections: [
{
components: 'src/WebComponent.js',
},
],
},
{
name: 'Examples',
href: '/#/Examples/Punctuality%20Map',
external: true,
sectionDepth: 2,
sections: [
{
name: 'Punctuality Map',
content: 'src/examples/Punctuality/README.md',
exampleMode: 'expand',
},
{
name: 'Casa Map',
content: 'src/examples/Casa/README.md',
exampleMode: 'expand',
},
{
name: 'Construction',
content: 'src/examples/Construction/README.md',
exampleMode: 'expand',
},
],
},
],
webpackConfig: {
module: {
rules: [
// Babel loader, will use your project’s .babelrc
// Transpile node dependencies, node deps are often not transpiled for IE11
{
test: [
/\/node_modules\/(regexpu-core|unicode-.*|chalk|acorn-.*|query-string|strict-uri-encode|proxy-polyfill)/,
/\/node_modules\/(split-on-first|react-dev-utils|ansi-styles|jsts|estree-walker|strip-ansi|javascript-stringify)/,
],
loader: 'babel-loader',
},
// Transpile js
{
test: /\.jsx?$/,
exclude: /node_modules/,
loader: 'babel-loader',
},
// Load css and scss files.
{
test: /\.s?css$/,
use: ['style-loader', 'css-loader', 'sass-loader?modules'],
},
{
test: /^((?!url).)*\.svg$/,
use: [
{
loader: require.resolve('babel-loader'),
options: {
// @remove-on-eject-begin
babelrc: false,
presets: [require.resolve('babel-preset-react-app')],
// @remove-on-eject-end
cacheDirectory: true,
},
},
require.resolve('@svgr/webpack'),
{
loader: require.resolve('file-loader'),
options: {
name: 'static/media/[name].[hash:8].[ext]',
},
},
],
},
{
test: /\.url\.svg$/,
loader: 'url-loader',
},
{
test: /\.png$/,
use: [
{
loader: 'url-loader',
},
],
},
],
},
plugins: [
new webpack.DefinePlugin({ 'process.env': JSON.stringify(process.env) }),
],
},
styles: {
StyleGuide: {
'@global body': {
overflowY: 'hidden',
overflowX: 'hidden',
},
},
},
showSidebar: true,
styleguideComponents: {
ComponentsList: path.join(__dirname, 'src/styleguidist/ComponentsList'),
StyleGuideRenderer: path.join(__dirname, 'src/styleguidist/StyleGuide'),
},
};