Registry / testing / doiuse-email

doiuse-email

JSON →
library0.4.1jsnpmunverified

Lint CSS and HTML for email client support against the Can I Email database. v0.4.1 is the latest stable release, with slow release cadence. Key differentiators: programmatic API and CLI, TypeScript types included, supports flexible client selection via glob patterns. Unlike other tools, it uses the same data source as caniemail.com and is inspired by doiuse for web browser support.

npm install doiuse-email
INSTALL
IMPORT
SIG · DOIUSE-EMAIL
D
doiuse-email
testingjavascriptv0.4.1
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

doIUseEmail
✓ import { doIUseEmail } from 'doiuse-email'
✗ const doIUseEmail = require('doiuse-email')
ESM-only. TypeScript types are bundled.
DoIUseOptions
✓ import { DoIUseOptions } from 'doiuse-email'
✗ none
Type import, available in TypeScript.
DoIUseResult
✓ import { DoIUseResult } from 'doiuse-email'
Result type for the return value.

Shows how to lint HTML for Gmail support using the programmatic API.

import { doIUseEmail } from 'doiuse-email'; const html = ` <!DOCTYPE html> <html> <body> <div style="background-color: orange;"></div> </body> </html> `; const result = doIUseEmail(html, { emailClients: ['gmail.*'], }); console.log(result.success); // true if no unsupported features, false otherwise console.log(result.notes); // Array of notes about support status per client
doiuse-email --version
Debug
Known issues
breakingRequires Node.js 12 or later. Older Node versions cause errors.
fix
Upgrade Node.js to 12+ or use an older version of this package if needed.
affects: >=0.0.0
deprecatedThe default export is deprecated in favor of named export 'doIUseEmail'.
fix
Use import { doIUseEmail } from 'doiuse-email' instead of import doiuse from 'doiuse-email'.
affects: 0.3.x
breakingCLI output format changed from an object with 'success' and 'notes' to a flat JSON array in v0.4.0.
fix
Update scripts that parse CLI output to expect an array of note objects instead of the previous object shape.
affects: >=0.4.0
gotchaOnly inline CSS is supported; external stylesheets are not checked.
fix
Ensure all CSS is inline within the HTML string passed to doIUseEmail.
affects: >=0.0.0
Errors
Common errors & fixes
Error: Cannot find module 'doiuse-email'
Package not installed or import path is wrong (e.g., using require in ESM-only package).
fix
Run 'npm install doiuse-email'. Use 'import { doIUseEmail } from 'doiuse-email' instead of require.
TypeError: doIUseEmail is not a function
Using default import incorrectly. The package only exports named exports.
fix
Change 'import doiuse from 'doiuse-email'' to 'import { doIUseEmail } from 'doiuse-email''.
SyntaxError: Unexpected token 'export'
Using CommonJS require in an ESM-only package.
fix
Use ES module import syntax. Alternatively, set 'type': 'module' in package.json or use .mjs extension.
Upgrade
Version history
0.4.1latest on npm
Audit
Dependencies
postcssrequiredUsed for parsing CSS within HTML
doiuserequiredCore linting logic adapted for email
micromatchrequiredGlob matching for email client selection
Agent activity
29 hits · last 30 days
node
28
OpenAI (training)
1
Resources
doiuse-email — npm install doiuse-email · libregistry