Skip to content

Commit e37c29b

Browse files
pierlonljharb
authored andcommitted
[readme] Update svgo configuration example
1 parent d4525ce commit e37c29b

File tree

1 file changed

+28
-5
lines changed

1 file changed

+28
-5
lines changed

Diff for: README.md

+28-5
Original file line numberDiff line numberDiff line change
@@ -54,13 +54,11 @@ npm install --save-dev babel-plugin-inline-react-svg
5454
"svgo": {
5555
"plugins": [
5656
{
57-
"removeAttrs": { "attrs": "(data-name)" }
57+
"name": "removeAttrs",
58+
"params": { "attrs": "(data-name)" }
5859
},
59-
{
60-
"cleanupIDs": true
61-
}
60+
"cleanupIDs"
6261
]
63-
6462
}
6563
}
6664
]
@@ -69,6 +67,31 @@ npm install --save-dev babel-plugin-inline-react-svg
6967

7068
```
7169

70+
**Note:** If `plugins` field is specified the default enabled `svgo` plugins will be overrided. Alternatively, if your Babel config is in JavaScript, the default list of plugins can be extended by making use of the `extendDefaultPlugins` utility provided by `svgo`.
71+
72+
```js
73+
const { extendDefaultPlugins } = require('svgo');
74+
75+
module.exports = {
76+
plugins: [
77+
[
78+
'inline-react-svg',
79+
{
80+
svgo: {
81+
plugins: extendDefaultPlugins([
82+
{
83+
name: 'removeAttrs',
84+
params: { attrs: '(data-name)' }
85+
},
86+
'cleanupIDs',
87+
])
88+
}
89+
}
90+
]
91+
]
92+
}
93+
```
94+
7295
### Via CLI
7396

7497
```sh

0 commit comments

Comments
 (0)