Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CRA2 style tag with svg as component #5273

Closed
tnargib opened this issue Oct 3, 2018 · 8 comments
Closed

CRA2 style tag with svg as component #5273

tnargib opened this issue Oct 3, 2018 · 8 comments

Comments

@tnargib
Copy link

tnargib commented Oct 3, 2018

Is this a bug report?

No.

I would like to use the new svg as react component feature from CRA2 but svgr keeps removing the <style> tag from my image. What I want is to use the inlineStyles plugin from svgo to transform the style tag into properties of the svg tag.

As I can see in #5062 and #4799 svgo has been disabled. Is there any way I can override the default configuration ? I have tried with a .svgrrc.json, a .svgo.yml and svgr key in the package.json but nothing worked.

@Timer
Copy link
Contributor

Timer commented Oct 3, 2018

Removing the <style> sounds like a bug to me.

@tnargib
Copy link
Author

tnargib commented Oct 3, 2018

Ok then, I thought it was intended. So if I understand, this is more a bug from svgr ? Maybe I should create an issue there ?

@Timer
Copy link
Contributor

Timer commented Oct 3, 2018

Yes, please. Your SVG should not be altered in any way.

@Timer Timer added this to the 2.0.x milestone Oct 3, 2018
@tnargib
Copy link
Author

tnargib commented Oct 4, 2018

It seems that not removing the style tag is a v3 feature of svgr. See gregberge/svgr#191.
Current version of react-scripts is 2.4.1 so maybe just an update would do the trick ?

@Timer Timer modified the milestones: 2.0.x, 2.0.5 Oct 4, 2018
@gaearon gaearon modified the milestones: 2.0.5, 2.0.6 Oct 14, 2018
@Timer Timer modified the milestones: 2.1.1, 2.1.x Oct 31, 2018
@aericson
Copy link
Contributor

#5361 seems to be on hold with a fix for this. Is there anything preventing a PR that upgrades just @svgr/webpack?

@aericson
Copy link
Contributor

I think #5816 closed this.

@VigneshPT
Copy link

I am still seeing this issue after #5816. Style tags are ignored.

@iansu iansu self-assigned this Feb 28, 2019
@iansu iansu modified the milestones: 2.1.x, 3.x Mar 10, 2019
@mrmckeb
Copy link
Contributor

mrmckeb commented Jun 16, 2021

CRA now ships with a newer version of SVGR and we think this is resolved. If this is still an problem, can you raise a new issue? Thanks!

@mrmckeb mrmckeb closed this as completed Jun 16, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants