You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
After running yarn svgr /tmp/sample.svg, I am expecting one of these outcomes:
the resulting file is JavaScript and width/height are present. Since the file is located away from svgr.config.js, it should ignore it.
the file is in TypeScript and width/height are absent. ie, svgr uses the config file.
The actual result is: file is in TypeScript with width/height set on svg. It seems like svgr is reading typescript: true from the config, but ignoring dimensions: false from the config.
I realize this is obscure and honestly not that important. But it was stumping me for a while, and took me a while to figure out why my output was unexpected. I figured if nothing else, just documenting the issue and letting the team decided what to do makes sense.
Also unlikely /tmp is required, I would expect just being in any other directory would cause this.
Workaround
you can add --no-dimensions when invoking svgr and that gets the expected results.
The text was updated successfully, but these errors were encountered:
Hey @city41 👋,
Thank you for opening an issue. We'll get back to you as soon as we can.
Please, consider supporting us on Open Collective. We give a special attention to issues opened by backers.
If you use SVGR at work, you can also ask your company to sponsor us ❤️.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
Out of curiousity, where did you run the command from if not /tmp? I'd look at the reproduction repo, but you've removed it.
I'm interested in what your use-case was for the dimensions: false option, would the SVGO removeDimensions: true config have worked just as well? (it requires both width and height to remove dimensions, and if no viewBox is present it will add one based on those dimensions)
🐛 Bug Report
When running svgr (from
@svgr/cli
) against an svg located in/tmp
, thedimensions
setting in svgr.config.js is ignoredTo Reproduce
Small sample case and repro steps here: https://github.com/city41/svgrDimensionsTest
Expected behavior
After running
yarn svgr /tmp/sample.svg
, I am expecting one of these outcomes:The actual result is: file is in TypeScript with width/height set on svg. It seems like svgr is reading
typescript: true
from the config, but ignoringdimensions: false
from the config.Link to repl or repo (highly encouraged)
https://github.com/city41/svgrDimensionsTest
NOTE
I realize this is obscure and honestly not that important. But it was stumping me for a while, and took me a while to figure out why my output was unexpected. I figured if nothing else, just documenting the issue and letting the team decided what to do makes sense.
Also unlikely
/tmp
is required, I would expect just being in any other directory would cause this.Workaround
you can add
--no-dimensions
when invoking svgr and that gets the expected results.The text was updated successfully, but these errors were encountered: