Registry / testing / html-preflight

html-preflight

JSON →
library0.4.1jsnpmunverified

A plugin runner for transforming HTML email content before sending, maximizing compression without distortion. Current stable version is 0.4.1 (released 2016, no recent updates). It accepts an array of plugin functions that process HTML sequentially, with built-in support for a MinifierPlugin. Unlike monolithic minifiers, it offers composable processing steps. Minimal documentation and no active maintenance.

npm install html-preflight
INSTALL
IMPORT
SIG · HTML-PREFLIGHT
H
html-preflight
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.

HTMLPreflight
const HTMLPreflight = require('html-preflight');
import HTMLPreflight from 'html-preflight';
This package uses CommonJS and does not support ESM imports.
MinifierPlugin
const MinifierPlugin = require('html-preflight').MinifierPlugin;
const { MinifierPlugin } = require('html-preflight');
MinifierPlugin is exported as a property of the main module, not a named export.
run()
const preflight = new HTMLPreflight(plugins); preflight.run(htmlString, options, callback);
run is an instance method; it is not exported directly.

Demonstrates creating an HTMLPreflight instance with a MinifierPlugin, running it on an HTML string with stats enabled.

const HTMLPreflight = require('html-preflight'); const MinifierPlugin = require('html-preflight').MinifierPlugin; const minifier = new MinifierPlugin(); const preflight = new HTMLPreflight([minifier.run.bind(minifier)]); const htmlString = '<html><head></head><body><p>Hello</p></body></html>'; preflight.run(htmlString, { stats: true }, (err, finalHtml) => { if (err) console.error(err); else console.log('Final HTML:', finalHtml); });
Debug
Known issues
gotchaPlugins must be functions; if they need access to 'this', bind them explicitly.
fix
Use .bind(pluginInstance) when passing methods as plugins.
affects: >=0.0.0
gotchaPackage is not actively maintained; last release in 2016. May have compatibility issues with modern Node.js or HTML email formats.
fix
Consider alternatives like 'juice' or 'email-comb' for email preprocessing.
affects: >=0.0.0
gotchaNo TypeScript type definitions available. Using with TypeScript requires manual type declarations.
fix
Create a .d.ts file or use 'any' type.
affects: >=0.0.0
Errors
Common errors & fixes
TypeError: plugins[i] is not a function
Passing an object or non-function as a plugin.
fix
Ensure each element in the plugins array is a function (e.g., use .bind() on methods).
ERR_REQUIRE_ESM: require() of ES Module
Trying to import the package in an ESM context (Node.js with type: module).
fix
Use dynamic import() or convert to CommonJS.
Upgrade
Version history
0.4.1latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
4 hits · last 30 days
node
4
Resources
html-preflight — npm install html-preflight · libregistry