-
Notifications
You must be signed in to change notification settings - Fork 0
/
options.js
87 lines (69 loc) · 1.91 KB
/
options.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
module.exports = () => {
return {
id: 'svg-minifier',
dirs: [],
exclude: [],
excludeSubDir: false,
outputDir: 'dist',
outputMetadata: true,
outputRuntime: true,
silent: false,
logDuplicates: true,
onSVGName: function(name, item) {
// filter
// if (name === 'xxx') {
// return;
// }
return this.onSVGNameDefault(name, item);
},
onSVGContent: function(content, item) {
// svg content handler
// return newContent;
},
onSVGDocument: function($svg, item, $) {
// svg DOM handler
},
onSVGOptimized: function($svg, item, $) {
// svg DOM handler
// filter
// if (item.name === 'xxx') {
// return false;
// }
},
onSVGError: function(result, item, $) {
return this.onSVGErrorDefault(result, item, $);
},
onFinish: function(options, metadata) {
},
// additional metadata
metadata: {},
// https://github.com/svg/svgo
svgo: {
plugins: [
{
name: 'preset-default',
params: {
overrides: {
inlineStyles: {
onlyMatchedOnce: false
}
}
}
},
{
name: 'prefixIds'
},
{
name: 'convertStyleToAttrs'
},
{
name: 'removeStyleElement'
},
{
name: 'removeScriptElement'
}
],
multipass: true
}
};
};