Skip to content

Commit 155aba3

Browse files
committed
Add loader config option for customizing svgo plugins
1 parent ff84278 commit 155aba3

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

index.js

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
11
var svg = require('svgo');
2+
var loaderUtils = require('loader-utils');
23
var compiler = require('vue-template-compiler');
34

4-
var svgo = new svg({
5-
plugins: ['removeDoctype', 'removeComments'],
6-
});
7-
85
module.exports = function (content) {
6+
var options = loaderUtils.getOptions(this);
7+
var svgo = new svg({
8+
plugins: options.svgo || ['removeDoctype', 'removeComments'],
9+
});
10+
911
this.cacheable && this.cacheable(true);
1012
this.addDependency(this.resourcePath);
1113

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
"vue-template-compiler": "^2.0.0"
1919
},
2020
"dependencies": {
21+
"loader-utils": "^1.1.0",
2122
"svgo": "^0.7.2"
2223
}
2324
}

0 commit comments

Comments
 (0)