unified

Project: rehypejs/rehype-minify

Package: hast-util-is-css-link@2.0.0

  1. Dependents: 5
  2. hast utility to check if an element is a css link
  1. util 143
  2. utility 139
  3. unist 127
  4. html 122
  5. hast 72
  6. hast-util 46
  7. link 14
  8. css 9

hast-util-is-css-link

Build Coverage Downloads Size Sponsors Backers Chat

Check if an element is a CSS link.

Install

This package is ESM only: Node 12+ is needed to use it and it must be importeded instead of requiredd.

npm:

npm install hast-util-is-css-link

This package exports the following identifiers: isCssLink. There is no default export.

Use

import {h} from 'hastscript'
import {isCssLink} from 'hast-util-is-css-link'

isCssLink(h('link', {rel: ['stylesheet', 'author']})) //=> true
isCssLink(h('link', {rel: ['stylesheet'], type: 'text/css'})) //=> true
isCssLink(h('link', {rel: ['stylesheet'], type: 'text/foo'})) //=> false

API

isCssLink(node)

Return true if node is a <link> element with a rel list that contains 'stylesheet' and has no type, an empty type, or 'text/css' as its type.

Contribute

See contributing.md in rehypejs/.github for ways to get started. See support.md for ways to get help.

This project has a code of conduct. By interacting with this repository, organization, or community you agree to abide by its terms.

License

MIT © Titus Wormer