File tree Expand file tree Collapse file tree 3 files changed +17
-4
lines changed Expand file tree Collapse file tree 3 files changed +17
-4
lines changed Original file line number Diff line number Diff line change @@ -12,6 +12,15 @@ yarn add --dev vue-template-compiler vue-svg-loader
12
12
{
13
13
test: / \. svg$ / ,
14
14
loader: ' vue-svg-loader' , // `vue-svg` for webpack 1.x
15
+ options: {
16
+ // optional [svgo](https://github.com/svg/svgo) options
17
+ svgo: {
18
+ plugins: [
19
+ {removeDoctype: true },
20
+ {removeComments: true }
21
+ ]
22
+ }
23
+ }
15
24
}
16
25
```
17
26
Original file line number Diff line number Diff line change 1
1
var svg = require ( 'svgo' ) ;
2
+ var loaderUtils = require ( 'loader-utils' ) ;
2
3
var compiler = require ( 'vue-template-compiler' ) ;
3
4
4
- var svgo = new svg ( {
5
- plugins : [ 'removeDoctype' , 'removeComments' ] ,
6
- } ) ;
7
-
8
5
module . exports = function ( content ) {
6
+ var options = loaderUtils . getOptions ( this ) || { } ;
7
+ var svgoOptions = options . svgo || {
8
+ plugins : [ { removeDoctype : true } , { removeComments : true } ] ,
9
+ } ;
10
+ var svgo = new svg ( svgoOptions ) ;
11
+
9
12
this . cacheable && this . cacheable ( true ) ;
10
13
this . addDependency ( this . resourcePath ) ;
11
14
Original file line number Diff line number Diff line change 18
18
"vue-template-compiler" : " ^2.0.0"
19
19
},
20
20
"dependencies" : {
21
+ "loader-utils" : " ^1.1.0" ,
21
22
"svgo" : " ^0.7.2"
22
23
}
23
24
}
You can’t perform that action at this time.
0 commit comments