Search


Search something to see results

ImageRule

An image rule selects a subset of images and applies some ImageOptions to it. See SpeedKitConfig.image | the image option for more information.

1.5.0

interface ImageRule {
    enabledSites?: SpeedKitRule[];
    imageFunction?: string | ImageFunction;
    options?: ImageOptions;
    rules?: SpeedKitRule[];
}

Index

Properties

Properties

enabledSites?: SpeedKitRule[]

The sites on which this image rule is enabled.

[{ "pathname": "/product/details/" }]

In this example, Speed Kit will apply image options given by the options property to all images requested from a product details page under the path of "/product/details/". All other images will not be affected by this rule.

1.9.0

imageFunction?: string | ImageFunction

Callback that adapts image URL.

2.11.0

options?: ImageOptions

The options to apply to the selected images.

{ quality: 75, webp: false }

Applies a quality of 75% and disables WebP support for all images affected by this rule.

1.5.0

rules?: SpeedKitRule[]

The rules to match only some images.

[{ "pathname": "/images/photos/" }]

In this example, Speed Kit will apply image options given by the options property to all images under the "/images/photos/" path. All other images will not be affected by this rule.

1.5.0