Skip to content

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

Notifications You must be signed in to change notification settings

GreyAdmiral/avif-webp-checker

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 

Repository files navigation

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();

About

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

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published