npm.io
1.0.2 • Published 8 years agoCLI

path-to-import

Licence
ISC
Version
1.0.2
Deps
1
Vulns
0
Weekly
0
Stars
1

path-to-import

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/logo@2x.png" alt="" />

After:

import logo2xPng from 'assets/images/logo@2x.png';
.
.
.
<img src={logo2xPng} alt="" />