Skip to content

CRA2 style tag with svg as component #5273

Closed

Description

@tnargib

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.

Activity

  1. Timer commented on Oct 3, 2018

    @Timer
    Contributor

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

  2. tnargib commented on Oct 3, 2018

    @tnargib
    Author

    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 ?

  3. Timer commented on Oct 3, 2018

    @Timer
    Contributor

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

  4. added this to the 2.0.x milestone on Oct 3, 2018
  5. tnargib commented on Oct 4, 2018

    @tnargib
    Author

    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 ?

  6. modified the milestones: 2.0.x, 2.0.5 on Oct 4, 2018
  7. modified the milestones: 2.0.5, 2.0.6 on Oct 14, 2018
  8. modified the milestones: 2.1.1, 2.1.x on Oct 31, 2018
  9. aericson commented on Jan 28, 2019

    @aericson
    Contributor

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

  10. aericson commented on Feb 11, 2019

    @aericson
    Contributor

    I think #5816 closed this.

  11. VigneshPT commented on Feb 28, 2019

    @VigneshPT

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

  12. self-assigned this
    on Feb 28, 2019
  13. modified the milestones: 2.1.x, 3.x on Mar 10, 2019
  14. mrmckeb commented on Jun 16, 2021

    @mrmckeb
    Contributor

    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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions