Tool for replacing src="path" by import statement for React components.
path-to-import -h
or p2i -h
for usage
Example:
p2i --src=./src --ext=js,jsx --prefix=assets
Before:
<img src="images/[email protected]" alt="" />
After:
import logo2xPng from 'assets/images/[email protected]';
.
.
.
<img src={logo2xPng} alt="" />