Transform Pipeline
Transform Pipeline
Section titled “Transform Pipeline”Relaxicons fetches raw SVG, then processes it to make theme-friendly components.
- Remove
widthandheightattributes to allow flexible sizing. - Ensure
fill="currentColor"orstroke="currentColor"is applied for color inheritance. - Strip extraneous
data-attributes that don’t affect rendering. - Preserve
viewBoxfor scaling. Optional: IfoptimizeSvgis enabled in config andsvgois installed, the raw SVG is optimized with SVGO before transformation. Provide an object to pass custom SVGO options.
Result Structure
Section titled “Result Structure”Internal representation:
{ attrs: { viewBox: '0 0 24 24', fill: 'none' }, children: '<path ... />'}This gets fed into the specific framework template.
Customization
Section titled “Customization”You can modify transform logic in src/utils/transformSvg.js.
Testing
Section titled “Testing”Jest tests (tests/transformSvg.test.js) assert attribute normalization.