SVG icons can be downloaded anywhere. When using these SVGs as icons in production, they may not be able to align on the same horizontal line, they can't change color dynamically, along with other problems.
This script does the following things:
- Remove undesired attributes in
pathandsvgtags - Remove group content outside, and get rid of
gtags - Add
id=maintosvgtag to supportuseof an external source - Replace
fillandstrokecolor tocurrentColor, so the color of the SVG icon can be changed by css - (Optional) Adjust viewBox so it fits the content (0 margin)