1.0.0 • Published 3 years ago

rollup-plugin-image-assets v1.0.0

Weekly downloads
-
License
MIT
Repository
github
Last release
3 years ago

rollup-plugin-image-assets

Forked from rollup-plugin-image-files

Added the following enhancements:

  • supports custom output directory for images.
  • copy and rename image with hash: [name]_[md5hash].[extname].

Usage

Install the plugin via npm:

npm install --save-dev rollup-plugin-image-assets

Add the plugin to your rollup config:

import images from 'rollup-plugin-image-assets';

export default {
	entry: 'src/index.js',
	des: 'dist/bundle.js',
	plugins: [
		images({
			output: 'build/images'
		})
	]
};

Require some images in your source:

import React from 'react';
import { Image } from 'react-native';
import imageSrc from '../path/to/image.png';

export default const MyComponent = () => (
  <img src={imageSrc} alt='' />
);