Node.js wrapper for premailer.dialect.ca
MIT License
A simple api wrapper for http://premailer.dialect.ca, a great tool for inlining css before you send an email.
node-premailer simplifies api integration by calling the Premailer API to inline css styles (and other options such as removing comments, classes and ids), then retrieving the generated html and text from their respective URLs before passing them to your callback.
Or from source:
var premailer = require('premailer-api');
var emailTemplate = `
<html>
<head>
<title>My Email</title>
<style type="text/css">
a { color: #336699; }
</style>
</head>
<body>
Styles inlined with
<a href="http://premailer.dialect.ca">Premailer</a> via
<a href="https://github.com/JedWatson/node-premailer">node-premailer</a>.
</body>
<html>`;
premailer.prepare({ html: emailTemplate }, function (err, email) {
if (err) throw err;
res.send(email.html);
});
adapter
baseUrl
|| base_url
lineLength
|| line_length
linkQueryString
|| link_query_string
preserveStyles
|| preserve_styles
removeIds
|| remove_ids
removeClasses
|| remove_classes
removeComments
|| remove_comments
MIT Licensed. Copyright Jed Watson 2016.
A big thank you to Dialect for Premailer, and for making the API freely available.
There's also a web version available here: http://premailer.dialect.ca
And you can check out the source code for Premailer itself here: https://github.com/alexdunae/premailer/