-
Notifications
You must be signed in to change notification settings - Fork 27
/
styleguide.config.js
124 lines (123 loc) · 3.22 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
const path = require('path')
module.exports = {
sections: [
{
name: 'Introduction',
content: 'docs/Introduction.md'
},
{
name: 'Styles',
content: 'docs/Styles/Introduction.md',
sections: [
{
name: 'Writing SCSS / CSS',
content: 'docs/Styles/Guidelines.md'
},
{
name: 'Local Scope / Component Styles',
content: 'docs/Styles/LocalScope.md'
}
]
},
{
name: 'Components',
content: 'docs/Components/Introduction.md',
sections: [
{
name: 'Developing Components',
content: 'docs/Components/Development.md'
},
{
name: 'Global Components',
content: 'docs/Components/GlobalComponents.md',
components: 'components/Global/**/[A-Z]*.vue'
},
{
name: 'Specific Components',
content: 'docs/Components/SpecificComponents.md',
components: 'components/!(Global)**/[A-Z]*.vue'
}
]
}
],
// Return path with import example for specific components
getComponentPathLine (componentPath) {
const name = path.basename(componentPath, '.vue')
const dir = path.dirname(componentPath)
if (dir.includes('Global')) {
return componentPath
}
return `import ${name} from '~/${dir}/${name}.vue'`
},
assetsDir: 'static',
require: ['assets/styles/styleguide.scss'],
template: 'docs/template/index.html',
title: 'HC Style Guide',
serverHost: 'localhost',
ignore: [
'**/__tests__/**',
'**/*.test.js',
'**/*.test.jsx',
'**/*.spec.js',
'**/*.spec.jsx',
'**/_*.vue'
],
webpackConfig: {
module: {
loaders: [
// Vue loader
{
test: /\.vue$/,
exclude: /node_modules/,
loader: 'vue-loader',
options: {
loaders: {
'js': 'babel-loader?presets[]=vue-app&babelrc=false'
}
}
},
// Babel loader, will use your project’s .babelrc
{
test: /\.js?$/,
exclude: /node_modules/,
loader: 'babel-loader?presets[]=vue-app&babelrc=false'
},
// Other loaders that are needed for your components
{
test: /\.css$/,
loader: 'style-loader!css-loader'
},
{
test: /\.scss/,
loader: 'style-loader!css-loader!sass-loader'
},
{
test: /\.(png|jpe?g|gif|svg)$/,
loader: 'url-loader',
options: {
limit: 1000, // 1KO
name: 'img/[name].[hash:7].[ext]'
}
},
{
test: /\.(woff2?|eot|ttf|otf)(\?.*)?$/,
loader: 'url-loader',
options: {
limit: 1000, // 1 KO
name: 'fonts/[name].[hash:7].[ext]'
}
}
]
},
resolve: {
alias: {
'assets': path.resolve(__dirname, 'assets/'),
'~/components': path.resolve(__dirname, 'components/'),
'~/docs': path.resolve(__dirname, 'docs/'),
'~/helpers': path.resolve(__dirname, 'helpers/'),
'~/plugins': path.resolve(__dirname, 'plugins/'),
'~/locales': path.resolve(__dirname, 'locales/')
}
}
}
}