Skip to main content
버전: 2.x

📦 plugin-ideal-image

아주 이상적인 이미지(반응형, 지연 로딩, 저화질 플레이스홀더)를 만들어주는 도큐사우루스 플러그인입니다.

정보

By default, the plugin is inactive in development so you could always view full-scale images. If you want to debug the ideal image behavior, you could set the disableInDev option to false.

설치

npm install --save @docusaurus/plugin-ideal-image

사용법

해당 플러그인은 PNG, GIF, JPG 포맷만 지원합니다.

import Image from '@theme/IdealImage';
import thumbnail from './path/to/img.png';

// your React code
<Image img={thumbnail} />

// or
<Image img={require('./path/to/img.png')} />

설정

설정할 수 있는 필드

옵션타입기본값설명
namestringideal-img/[name].[hash:hex:7].[width].[ext]만들어질 파일을 위한 파일명 템플릿
sizesnumber[]original size원하는 모든 너비값을 설정합니다. 설정한 크기가 원본 이미지 너비보다 크다면 다음에 설정한 이미지 크기를 사용합니다(이미지 크기를 크게 만들지는 않습니다).
sizenumberoriginal size원하는 너비값을 설정합니다. 설정한 크기가 원본 이미지 너비보다 크다면 다음에 설정한 이미지 크기를 사용합니다(이미지 크기를 크게 만들지는 않습니다).
minnumberundefinedAs an alternative to manually specifying sizes, you can specify min, max and steps, and the sizes will be generated for you.
maxnumberundefinedSee min above
stepsnumber4Configure the number of images generated between min and max (inclusive)
qualitynumber85JPEG 압축 수준을 설정합니다.
disableInDevbooleantrueYou can test ideal image behavior in dev mode by setting this to false. Tip: use network throttling in your browser to simulate slow networks.

설정 예시

다음은 설정 예시입니다: