The plugin checks whether the AVIF and WebP browser supports and adds the appropriate classes to the tag html.
npm i avif-webp-checker
const isAvifWebp = require("avif-webp-checker");
or
import isAvifWebp from 'avif-webp-checker'
Type: object
Type: string
Default: all
Possible values:
- «avif» — Add only support «AVIF»
- «webp» — Add only support «Webp»
- «all» — Add support «AVIF» and «Webp»
Type: string
Default: avif
Class is added if the browser supports the AVIF format
Type: string
Default: webp
Class is added if the browser supports the Webp format
Type: boolean
Default: true
In the "all" mode, only 1 of the classes is added.If the browser supports the AVIF format adds AVIF support class, if the browser does not support the AVIF format, but supports Webp format. Webp support class is added.
const isAvifWebp = require("avif-webp-checker");
isAvifWebp({mode: "webp", webpClass: "mywebpclass"});
or
const isAvifWebp = require("avif-webp-checker");
isAvifWebp();