svgo removeAttrs 如何指定要删除的属性
svgo removeAttrs how to specify attrs to remove
我已将 removeAttrs 设置为 true,我想删除所有填充和颜色:
{
loader: 'svgo-loader',
options: {
plugins: [
{ removeNonInheritableGroupAttrs: true },
{ collapseGroups: true },
{ removeAttrs: true },
],
},
},
但我不知道如何在其中指定要删除的属性...
我是这样解决的:
{
loader: 'svgo-loader',
options: {
plugins: [
{ removeNonInheritableGroupAttrs: true },
{ collapseGroups: true },
{ removeAttrs: { attrs: '(fill|stroke)' } },
]
}
}
我已将 removeAttrs 设置为 true,我想删除所有填充和颜色:
{
loader: 'svgo-loader',
options: {
plugins: [
{ removeNonInheritableGroupAttrs: true },
{ collapseGroups: true },
{ removeAttrs: true },
],
},
},
但我不知道如何在其中指定要删除的属性...
我是这样解决的:
{
loader: 'svgo-loader',
options: {
plugins: [
{ removeNonInheritableGroupAttrs: true },
{ collapseGroups: true },
{ removeAttrs: { attrs: '(fill|stroke)' } },
]
}
}