Repository navigation
Use svgr for SVGs - #244
Conversation
Less magic, less dependencies, less security warnings. See WordPress/gutenberg#18243
|
What's the improvement here? Don't really see it in the linked GB issue. |
|
We currently use s combination of a webpack loader and a Babel plugin for this, which are both pretty much unmaintained and also cause warnings to be raised by npm‘s audit command. The linked PR shows that we can simplify this by using the more maintained svgr library which is now integrated in the wp-scripts suite of tools. |
Sounds good with me! The syntax is a little crude though - is there anyway to make the named |
|
I thought not, but maybe it is possible: https://react-svgr.com/docs/webpack/#usage I'll check again. Edit: looks like that's indeed intended behavior: the default export is for |
|
Just noticed some issues where icons are cropped. I'll take a look at that. Edit: resolved in 2543566 |
|
@swissspidy How did you get these SVG changes done? Is there some linter/commit hook for that? |
|
You mean the removal of width/height attributes? Manually. But there might be a svgr config for that. Will check! And changing the imports, well, without that the editor wouldn‘t run. But perhaps the linter might help there too, will check that. |
Width/height and currentColor. I think it'd be enough to simply error out to remove manually. |
|
Sounds good! I‘ll see whether it warrants a new PR or not. |
|
otherwise lgtm |
barklund
left a comment
There was a problem hiding this comment.
If it's better, it's better!
#welcometotautologyclub
|
@dvoytenko Done in 76aff44 🎉 |
| - removeDimensions: true | ||
| - convertColors: | ||
| currentColor: true |
There was a problem hiding this comment.
This is awesome magic! Love it!
Less magic, less dependencies, less security warnings.
See WordPress/gutenberg#18243