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
1212{
1313 test: / \. svg$ / ,
1414 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+ }
1524}
1625```
1726
Original file line number Diff line number Diff line change 11var svg = require ( 'svgo' ) ;
2+ var loaderUtils = require ( 'loader-utils' ) ;
23var compiler = require ( 'vue-template-compiler' ) ;
34
4- var svgo = new svg ( {
5- plugins : [ 'removeDoctype' , 'removeComments' ] ,
6- } ) ;
7-
85module . 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+
912 this . cacheable && this . cacheable ( true ) ;
1013 this . addDependency ( this . resourcePath ) ;
1114
Original file line number Diff line number Diff line change 1818 "vue-template-compiler" : " ^2.0.0"
1919 },
2020 "dependencies" : {
21+ "loader-utils" : " ^1.1.0" ,
2122 "svgo" : " ^0.7.2"
2223 }
2324}
You can’t perform that action at this time.
0 commit comments