mirror of
https://github.com/facebook/docusaurus.git
synced 2025-07-15 15:55:56 +02:00
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: Ben Gubler <nebrelbug@gmail.com> Co-authored-by: Davide Donadio <davide.donadio@it.clara.net> Co-authored-by: Petter Drønnen <36735557+dr0nn1@users.noreply.github.com> Co-authored-by: Moritz Stückler <moritz@bitbetter.de> Co-authored-by: Mysterious_Dev <40738104+Mysterious-Dev@users.noreply.github.com> Co-authored-by: TrueQAP <32407751+trueqap@users.noreply.github.com> Co-authored-by: Kagan <34136752+kagankan@users.noreply.github.com> Co-authored-by: Dewansh Thakur <71703033+dewanshDT@users.noreply.github.com> Co-authored-by: Armano <armano2@users.noreply.github.com> Co-authored-by: Anas <60762285+Anasqx@users.noreply.github.com> Co-authored-by: Tanner Dolby <tannercdolby@gmail.com> Co-authored-by: Davide Donadio <davide.donadio94@gmail.com> Co-authored-by: biplavmz <68702055+biplavmz@users.noreply.github.com> Co-authored-by: Vishruta Patil <72292532+Vishruta-Patil@users.noreply.github.com> fix(theme-classic): fix tab focus bug in dropdown (#8697) (#8699) fix(theme): improve color toggle when using dark navbar (#8615) fix(theme-translations): fix wrong arabic words (tip/next) (#8744) fix(core): baseUrl error banner link anchor case (#8746) fix(search): search page should react to querystring changes + cleanup/refactor (#8757) fix(theme): allow tabs children to be falsy (#8801) fix(theme): codeblock buttons should be kept on the right when using RTL locale (#8803) |
||
---|---|---|
.. | ||
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 |