Skip to content

Commit 5f21a62

Browse files
committed
docs: ✏️ Add description to Config
1 parent 6b6e986 commit 5f21a62

File tree

1 file changed

+32
-0
lines changed

1 file changed

+32
-0
lines changed

src/utils/getConfig.ts

+32
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,48 @@
11
import type { AvifOptions, JpegOptions, PngOptions, WebpOptions } from 'sharp'
22

33
export type Config = {
4+
/**
5+
* Specify if you are customizing the default output directory, such as next export -o outDir.
6+
*
7+
* @type {string}
8+
*/
49
outDir?: string
10+
/**
11+
* You can customize the directory to output optimized images.
12+
* The default is '_next/static/chunks/images'.
13+
*
14+
* @type {string}
15+
*/
516
imageDir?: string
17+
/**
18+
* Required if you have set basePath in next.config.js.
19+
* Please set the same value.
20+
*
21+
* @type {string}
22+
*/
623
basePath?: string
24+
/**
25+
* You can customize the generation of file names.
26+
*
27+
* ❗️Attention
28+
* When making this setting, make sure that the file names (including the path part) of different images do not cover each other.
29+
* Specifically, include the name, width, quality, and extension in the return value. If path is not included, all src's should be specified with import or require so that they can be distinguished by their hash value even if they have the same filename.
30+
*
31+
* @type {({ path: string, name: string, width: number, quality: number, extension: string }) => string}
32+
*/
733
filenameGenerator?: (generatorProps: {
834
path: string
935
name: string
1036
width: number
1137
quality: number
1238
extension: string
1339
}) => string
40+
/**
41+
* You can set optimization options for each extension.
42+
* Please refer to the official sharp documentation for more information.
43+
*
44+
* @type {{ png?: import('sharp').PngOptions, jpg?: import('sharp').JpegOptions, webp?: import('sharp').WebpOptions, avif?: import('sharp').AvifOptions } }}
45+
*/
1446
sharpOptions?: {
1547
png?: PngOptions
1648
jpg?: JpegOptions

0 commit comments

Comments
 (0)