Skip to content

Commit cf6b059

Browse files
committed
Restore plugin configuration to svgo config
1 parent 586a440 commit cf6b059

2 files changed

Lines changed: 18 additions & 8 deletions

File tree

bin/svgs.js

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,6 @@ const alerts = resolve('config/alerts');
2020
const config = resolve('config/svgs');
2121
const global = resolve('config/global');
2222

23-
const plugins = {
24-
plugins: Object.keys(config.svgo).map((p) => {p: config.svgo[p]})
25-
};
26-
2723
/**
2824
* Constants
2925
*/
@@ -145,7 +141,10 @@ const svgo = async (file) => {
145141
try {
146142
let data = fs.readFileSync(file, 'utf-8');
147143

148-
let optimized = await optimize(data, {path: file});
144+
let optimized = await optimize(data, {
145+
path: file,
146+
...config.svgo
147+
});
149148

150149
return optimized.data;
151150
} catch (err) {

config/svgs.js

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,21 @@ module.exports = {
2222
/**
2323
* Plugin options for SVGO
2424
*
25-
* @source https://github.com/svg/svgo#what-it-can-do
25+
* @source https://github.com/svg/svgo#built-in-plugins
2626
*/
27-
svgo: {
28-
convertPathData: false,
27+
svgo: {
28+
plugins: [
29+
{
30+
name: 'preset-default',
31+
params: {
32+
overrides: {
33+
convertPathData: false,
34+
inlineStyles: false,
35+
cleanupIDs: false
36+
}
37+
}
38+
}
39+
]
2940
},
3041

3142
/**

0 commit comments

Comments
 (0)