Skip to content

Commit 013e726

Browse files
author
visualfanatic
committed
First version
1 parent 55506da commit 013e726

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

index.js

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
var svg = require('svgo');
2+
3+
var svgo = new svg({
4+
plugins: ['removeDoctype', 'removeComments'],
5+
});
6+
7+
module.exports = function (content) {
8+
this.cacheable && this.cacheable(true);
9+
this.addDependency(this.resourcePath);
10+
11+
var cb = this.async();
12+
13+
svgo.optimize(content, function (result) {
14+
if (result.error) {
15+
return cb(result.error);
16+
}
17+
cb(null, "module.exports = {template: '" + result.data + "'};");
18+
});
19+
};

0 commit comments

Comments
 (0)