-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy path.svgrrc.js
67 lines (67 loc) · 1.37 KB
/
.svgrrc.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
module.exports = {
svgo: true,
svgoConfig: {
plugins: [
{
name: 'preset-default',
params: {
overrides: {
removeViewBox: false
}
}
},
{
name: 'removeAttrs',
params: {
attrs: [
'data-name',
'fill',
'svg:width',
'svg:height'
]
}
},
{
name: 'removeXMLNS',
params: true
},
{
name: 'convertStyleToAttrs',
params: true
}
]
},
svgProps:{
focusable:false
},
expandProps: 'end',
semi: true,
typescript: true,
indexTemplate: (filePaths) => {
const exportEntries = filePaths.map((filePath) => {
const files = filePath.split('/');
const basename = files[files.length - 1].split('.')[0];
return `export { default as ${basename} } from './${basename}';`;
});
exportEntries.push("export type { IconProps } from '../interfaces';");
return `${exportEntries.join('\n')}\n`;
},
jsx: {
babelConfig: {
plugins: [
[
'@svgr/babel-plugin-add-jsx-attribute',
{
elements: ['svg', 'path', 'rect'],
attributes: [
{
name: 'fill',
value: 'currentColor',
},
],
},
],
],
},
},
};