mirror of
https://github.com/facebook/docusaurus.git
synced 2025-05-01 11:18:24 +02:00
Co-authored-by: Jan Peer Stoecklmair <jan.peer.stoecklmair@dynatrace.com> Co-authored-by: Joshua Chen <sidachen2003@gmail.com> Co-authored-by: sebastienlorber <lorber.sebastien@gmail.com> Co-authored-by: Sébastien Lorber <slorber@users.noreply.github.com> Co-authored-by: LittleboyHarry <littleboyharry@qq.com> Co-authored-by: Mikey O'Toole <mikey@homotechsual.dev> Co-authored-by: Jan Peer Stöcklmair <jan.oster94@gmail.com> Co-authored-by: Nguyễn Thành Nam <namnguyenthanh.work@gmail.com> Co-authored-by: Sanjaiyan Parthipan <parthipankalayini@gmail.com> Co-authored-by: Ramazan SANCAR <ramazansancar4545@gmail.com> Co-authored-by: mturoci <64769322+mturoci@users.noreply.github.com> Co-authored-by: Adnan Hashmi <56730784+adnanhashmi09@users.noreply.github.com> Co-authored-by: Pranav Joglekar <pranav2000joglekar@gmail.com> Co-authored-by: forgeRW <20483211+forgeRW@users.noreply.github.com> Co-authored-by: Masahiko Hara <pasora@sfc.wide.ad.jp> Co-authored-by: Johan Fagerberg <johanringmann@gmail.com> Co-authored-by: John Reilly <johnny_reilly@hotmail.com> Co-authored-by: Sam Wall <oss@samuelwall.co.uk> Co-authored-by: Jeferson S. Brito <30840709+jeferson-sb@users.noreply.github.com> Co-authored-by: evan <evanmccarthy@outlook.com> Co-authored-by: Xabier Lahuerta Vazquez <xlahuerta@protonmail.com> Co-authored-by: Forresst <forresst17@gmail.com> Co-authored-by: Shanmughapriyan S <priyanshan03@gmail.com> Co-authored-by: Alexey Pyltsyn <lex61rus@gmail.com> |
||
---|---|---|
.. | ||
src | ||
.npmignore | ||
package.json | ||
README.md | ||
tsconfig.client.json | ||
tsconfig.json |
@docusaurus/plugin-ideal-image
Docusaurus Plugin to generate an almost ideal image (responsive, lazy-loading, and low quality placeholder).
Installation
yarn add @docusaurus/plugin-ideal-image
Modify your docusaurus.config.js
module.exports = {
...
+ plugins: ['@docusaurus/plugin-ideal-image'],
...
}
Usage
Support png, gif and jpg only
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')} />
Options
Option | Type | Default | Description |
---|---|---|---|
name |
string |
ideal-img/[name].[hash:hex:7].[width].[ext] |
Filename template for output files. |
sizes |
array |
original size | Specify all widths you want to use; if a specified size exceeds the original image's width, the latter will be used (i.e. images won't be scaled up). You may also declare a default sizes array in the loader options in your webpack.config.js . |
size |
integer |
original size | Specify one width you want to use; if the specified size exceeds the original image's width, the latter will be used (i.e. images won't be scaled up) |
min |
integer |
As an alternative to manually specifying sizes , you can specify min , max and steps , and the sizes will be generated for you. |
|
max |
integer |
See min above |
|
steps |
integer |
4 |
Configure the number of images generated between min and max (inclusive) |
quality |
integer |
85 |
JPEG compression quality |