-
-
Notifications
You must be signed in to change notification settings - Fork 425
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
Use the Svg prefix globally #667
Comments
Hello @advename, I understand your misunderstood and I will try to clear it up. The component name is Yes we only talk about the component name here, not the export name.
Yes only when the filename starts with a number. Just because we do not have a choice here, JavaScript does not allow export name starting with a number. Note starting a SVG file with a number is kind of weird, but SVGR handles all use-cases, so. I will not prefix everything with To resume, things are confusing for a new user only if it has filenames starting with a number, in this case yes it is. The implementation is SVGR is coherent, I don't want to change it. The "Monkey Patch" you proposed is not a "Monkey Patch" it is just a custom configuration, nothing more. Feel free to use it, it is perfectly fine 👍. The other option is to rename all your SVG's starting with a number with "svg-" and it will not be confusing any more 😉. |
One of my main point, beside keeping it coherent with the component name, is regarding your comment here in #190.
I.e., SVGR internally avoids "infinity" component name with prefixing it with IMHO, forcing end-users to |
@advename I understand but there is a workaround to not breaking the code, so it is not a problem. Everything generated should be valid, but the usage is the responsibility of the user. |
🚀 Feature Proposal
Keep it consistent and use the
Svg
prefix globally for:smiley.svg
->SvgSmiley.jsx
SvgSmiley()
(already implemented)index.js
exports, e.g. instead ofexport { default as Smiley } from './Smiley';
, doexport { default as SvgSmiley } from './Smiley';
Motivation
Regarding #190, all Component names should be prefixed with
Svg
.#383 mentions that the
index.js
only exports withSvg
prefix if the component name starts with a number.I know that it is possible to alias an import, but it's confusing for a new user to understand when/or when not the prefix is used.
End-users of this tool might have to run additional processing. First, after many trials and errors have I noticed the inconsistency.
Monkey Patch
Currently, I have to use a custom index template, e.g.
and run a command to rename all generated component files with an
Svg
prefix.The text was updated successfully, but these errors were encountered: