avif-webp-checker

1.0.0 • Public • Published

avif-webp-checker

The plugin checks whether the AVIF and WebP browser supports and adds the appropriate classes to the tag html.

Install

npm i avif-webp-checker

Import

const isAvifWebp = require("avif-webp-checker");

or

import isAvifWebp from 'avif-webp-checker'

Options

Type: object

mode

Type: string
Default: all
Possible values:

  • «avif» — Add only support «AVIF»
  • «webp» — Add only support «Webp»
  • «all» — Add support «AVIF» and «Webp»

avifClass

Type: string
Default: avif

Class is added if the browser supports the AVIF format

webpClass

Type: string
Default: webp

Class is added if the browser supports the Webp format

onlyClass

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.

Usage

const isAvifWebp = require("avif-webp-checker");

isAvifWebp({mode: "webp", webpClass: "mywebpclass"});

or

const isAvifWebp = require("avif-webp-checker");

isAvifWebp();

Package Sidebar

Install

npm i avif-webp-checker

Weekly Downloads

57

Version

1.0.0

License

MIT

Unpacked Size

4.28 kB

Total Files

3

Last publish

Collaborators

  • binarion