@atom8/image-to-react-component
v0.1.5
Published
Automatically convert an image or svg into a react component
Downloads
87
Readme
@atom8/image-to-react-component
Automatically convert an image or svg into a react component
Install
npm i @atom8/image-to-react-component --save-dev
Usage
import ImageToReactComponent from '@atom8/image-to-react-component';
// If you use CommonJS (i.e NodeJS environment), it should be:
// const { ImageToReactComponent } = require('@atom8/image-to-react-component').default;
const isDev = process.env.NODE_ENV === 'development';
if (isDev) {
const imageToReactComponent = new ImageToReactComponent({
input: path.resolve(__dirname, 'src/assets'),
output: path.resolve(__dirname, 'src/components/Images'),
extensions: ['.png', '.jpg', '.jpeg', '.svg'],
factor: true,
prettierConfigPath: './.prettierrc.cjs',
});
imageToReactComponent.init();
}
License
MIT © zhiyingzzhou