@hdot/validate
v0.0.7
Published
Validate HTML attributes based on the HTML spec
Downloads
20
Readme
hdot plugin: Attribute Validation
Automatically type check HTML attributes against the HTML spec, powered by markuplint.
Installation
npm i @hdot/plugins/validate
Usage
import validate from "@hdot/plugins/validate";
import { h, setPlugins } from "hdot";
setPlugins(h, [validate]);
h.div.id("my id")();
// ---> Error: 'my id' is not a valid DOMID.
Disabling in Production
If you running hdot in the browser, this plugin should typically not be used in production. Doing so will increase your bundle size.
If your build environment supports NODE_ENV
, you might do the following:
import { h, setPlugins } from "hdot";
const plugins = [];
if (process.env.NODE_ENV === "development") {
const { default: validate } = await import("@hdot/plugins/validate");
plugins.push(validate);
}
setPlugins(h, plugins);