-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvue.config.js
73 lines (69 loc) · 1.96 KB
/
vue.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
const path = require('path');
function configSVGIcon(config) {
// Exclude SVG sprite directory from default svg rule
config.module
.rule('svg')
.exclude.add(path.resolve(__dirname, './src/assets/svg-icons'))
.end();
// Options used by svgo-loader to optimize SVG files
// https://github.com/svg/svgo#what-it-can-do
const options = {
"cleanupAttrs": true,
"cleanupEnableBackground": true,
"cleanupIDs": true,
"cleanupListOfValues": true,
"cleanupNumericValues": true,
"collapseGroups": true,
"convertColors": true,
"convertPathData": true,
"convertShapeToPath": true,
"convertStyleToAttrs": true,
"convertTransform": true,
"mergePaths": true,
"removeComments": true,
"removeDesc": true,
"removeDimensions": true,
"removeDoctype": true,
"removeEditorsNSData": true,
"removeEmptyAttrs": true,
"removeEmptyContainers": true,
"removeEmptyText": true,
"removeHiddenElems": true,
"removeMetadata": true,
"removeNonInheritableGroupAttrs": true,
"removeRasterImages": true,
"removeTitle": true,
"removeUnknownsAndDefaults": true,
"removeUselessDefs": true,
"removeUnusedNS": true,
"removeUselessStrokeAndFill": true,
"removeAttrs": { "attrs": "(fill|stroke)"},
"removeXMLProcInst": true,
"removeStyleElement": true,
"removeUnknownsAndDefaults": true,
"sortAttrs": true
};
// Include only SVG sprite directory for new svg-icon rule
// Use svg-sprite-loader to build SVG sprite
// Use svgo-loader to optimize SVG files
config.module
.rule('svg-icon')
.test(/\.svg$/)
.include.add(path.resolve(__dirname, './src/assets/svg-icons'))
.end()
.use('svg-sprite-loader')
.loader('svg-sprite-loader')
.options({
symbolId: 'icon-[name]',
})
.end()
.use('svgo-loader')
.loader('svgo-loader')
.options(options)
.end();
}
module.exports = {
chainWebpack: config => {
configSVGIcon(config);
},
};