# checkcss

> Detect references to undefined CSS classes

Latest version **2.0.9** (published 2023-05-28) · ISC license · 0 weekly downloads

## Install

```sh
npm install checkcss
pnpm add checkcss
yarn add checkcss
bun add checkcss
```

## Health

**Score 30/100 (F)** — status: abandoned.

Positive: has types; esm support; no vulnerabilities; high quality score.

Warnings: low downloads.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 2.0.9 |
| Published | 2023-05-28 |
| First published | 2021-05-16 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 0 |
| Unpacked size | 31 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 27 |
| Maintainers | broofa |
| Keywords | css, class, classnames, missing, undefined, check, DOM |

## Links

- npm: https://www.npmjs.com/package/checkcss
- Repository: https://github.com/broofa/checkcss
- Homepage: https://github.com/broofa/checkcss#readme
- Issues: https://github.com/broofa/checkcss/issues
- Funding: https://github.com/sponsors/broofa
- npm.io page: https://npm.io/package/checkcss

## Alternatives

- [babylon](https://npm.io/package/babylon.md) — 5.1M weekly downloads
- [csscolorparser](https://npm.io/package/csscolorparser.md) — 3.7M weekly downloads
- [expr-eval-fork](https://npm.io/package/expr-eval-fork.md) — 1.5M weekly downloads
- [@leeoniya/ufuzzy](https://npm.io/package/@leeoniya/ufuzzy.md) — 247.7K weekly downloads
- [xml-parser](https://npm.io/package/xml-parser.md) — 78.4K weekly downloads

## Recent versions

- 2.0.9 (latest) — 2023-05-28
- 2.0.8 — 2023-05-10
- 2.0.7 — 2023-04-16
- 2.0.6 — 2023-03-31
- 2.0.5 — 2023-01-27
- 2.0.4 — 2022-12-27
- 2.0.3 — 2022-12-27
- 2.0.2 — 2022-12-24
- 2.0.1 — 2022-12-24
- 2.0.0 — 2022-12-22
- 1.3.1 — 2022-06-17
- 1.3.0 — 2022-06-16
- 1.2.0 — 2022-06-16
- 1.1.2 — 2021-07-22
- 1.1.1 — 2021-06-15
- … 4 more at https://npm.io/package/checkcss/versions

## README

# checkcss

Detect DOM elements that reference undefined CSS classes
## Installation

```bash
npm install checkcss
# or
yarn add checkcss
```

## Usage

```javascript
import { CheckCSS } from 'checkcss';

// Create CheckCSS instance
const checkcss = new CheckCSS();
checkcss.scan().watch();
```
... then look for messages like this in your browser console:
![image](https://user-images.githubusercontent.com/164050/209418239-dfd6584d-f1f3-4903-85fd-aeb3d5cb2e5a.png)

## Hooks
The following hooks are supported:
```javascript
// OPTIONAL: Hook for filtering classnames
checkcss.onClassnameDetected = function (classname, element) {
  // Return `false` to disable checks for `classname`.
  // For example, to ignore classnames starting with
  // "license-" or "maintainer-"...
  return /^license-|^maintainer-/.test(classname) ? false : true;
};

// OPTIONAL: Hook for custom logging
checkcss.onUndefinedClassname = function (classname) {
  // Custom logging goes here (replaces default log method)
};
```

---
_Source: https://npm.io/package/checkcss · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
