ππ½ππ½ππ½ Thanks for sharing.
So, I just want to confirm if the label or the icon prop being passed into the reusable component created in the latter part of the article has to match with the name of the svg file in the src/icons directory? Also, could the icons be discarded or they need to remain there even after generating the sprite?
Yes, the name of the svg file will be passed as the icon prop. The label prop is used for accessibility (for screen readers).
Theoretically, the icons could be discarded since the only thing we need is the svg sprite. But you donβt want to do that for several reasons
Version control. Ideally the sprite itself should not be committed to version control (to avoid merge conflicts). Hence the script generating the sprite (grunt) should be run as part of your CI/CD process, so youβll want the icons to be there when that is run
Youβll need to add new icons someday (the point is to be able to automate it). If youβd deleted previous icons and then added new icons, the new sprite generated will only contain the new icons and you wouldβve lost your previous icons
ππ½ππ½ππ½ Thanks for sharing.
So, I just want to confirm if the label or the icon prop being passed into the reusable component created in the latter part of the article has to match with the name of the svg file in the
src/icons
directory? Also, could the icons be discarded or they need to remain there even after generating the sprite?Thank you.
Yes, the name of the svg file will be passed as the
icon
prop. The label prop is used for accessibility (for screen readers).Theoretically, the icons could be discarded since the only thing we need is the svg sprite. But you donβt want to do that for several reasons
Version control. Ideally the sprite itself should not be committed to version control (to avoid merge conflicts). Hence the script generating the sprite (grunt) should be run as part of your CI/CD process, so youβll want the icons to be there when that is run
Youβll need to add new icons someday (the point is to be able to automate it). If youβd deleted previous icons and then added new icons, the new sprite generated will only contain the new icons and you wouldβve lost your previous icons
Makes sense. Thanks for the clarification.ππ½