一覧へ戻る
lisen6/rollup-plugin-img2(新しいタブで開きます)
主要言語: TypeScript
A Rollup plugin which imports JPG, PNG, GIF, SVG, and WebP files.
- star 数
- 2
- watcher 数
- 1
- fork 数
- 0
- issue 数
- 0
- 最終更新
- 2023/04/06
主要言語: TypeScript
A Rollup plugin which imports JPG, PNG, GIF, SVG, and WebP files.
Import image files with rollup. Let you import images just like what you do with webpack in your React code!
yarn add -D rollup-plugin-img2
or
npm install -D rollup-plugin-img2
or
pnpm install -D rollup-plugin-img2
In the rollup.config.js:
import image from 'rollup-plugin-img2'; export default { input: 'src/index.js', output: 'dist/bundle.js', plugins: [ image({ output: 'dist/images', hash: true, limit: 10000 }) ] };
and in your React code:
import img from 'path/image.png'; ... render() { return <img src={ img } />; } ...
You can pass an option to the image() just like above, and there are some options:
MIT