Detect DOM elements that reference undefined CSS classes
Installation
npm install checkcss# oryarn add checkcss
Usage
import { CheckCSS } from 'checkcss';// Create CheckCSS instanceconst checkcss = new CheckCSS();checkcss.scan().watch();
... then look for messages like this in your browser console:
Hooks
The following hooks are supported:
// OPTIONAL: Hook for filtering classnamescheckcss.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 loggingcheckcss.onUndefinedClassname = function (classname) { // Custom logging goes here (replaces default log method)};