Skip to content
This repository has been archived by the owner on Jan 21, 2024. It is now read-only.
/ html-preflight Public archive

The HTML email preflight process, maximizing compression without distortion

License

Notifications You must be signed in to change notification settings

Rebelmail/html-preflight

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

48 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

html-preflight

Build Status NPM version

HTMLPreflight is a runner of plugins that transform an email before sending it.

Example

var HTMLPreflight = require('html-preflight');
var Minifier = require('html-preflight').MinifierPlugin;

var minifier = new Minifier();
var preflight = new HTMLPreflight([minifier.run.bind(minifier)]);

preflight.run(htmlString, { stats: true }, function(err, finalHtml) {
  console.log(arguments);
});

Documentation

HTMLPreflight(plugins)

Takes in an array of functions. This functions will run in the order they were provided. Each will pass the resulting HTML string to the next function. Always keep in mind that if your provided function must have access to its scope, you will probably have to bind it to it.

run(htmlString, options, callback)

  • htmlString -> Initial HTML to transform.
  • options -> Object with flags for stats.
  • callback(err, html) -> Callback executed after plugins finish running. The second parameter will contain the final transformation

Enjoy

About

The HTML email preflight process, maximizing compression without distortion

Resources

License

Stars

Watchers

Forks

Packages

No packages published