inline-tailwind-emails
v1.0.0
Published
An inliner for Email templates written with HTML and Tailwind CSS
Downloads
2
Readme
Inline Tailwind Emails
This tool helps you inline your Email templates that use Tailwind.
Usage
npm i inline-tailwind-emails
and inline a single file with:
const { inlineTailwindEmail } = require("inline-tailwind-emails");
const inlineHtml = await inlineTailwindEmail(
`
<link rel="stylesheet" href="https://unpkg.com/tailwindcss@^2/dist/tailwind.min.css">
<div class="bg-red-500">
Hello World!
</div>
`,
{
url: "https://www.mywebsite.com"
}
);
or inline multiple files at once with:
const { inlineTailwindEmailFiles } = require("inline-tailwind-emails");
const results = await inlineTailwindEmailFiles(
[
"/path/to/file1.html",
"/path/to/file2.html",
"/path/to/file3.html"
],
{
url: "https://www.mywebsite.com"
}
);
/**
* results:
* [
* {
* "filepath": "/path/to/file1.html",
* "html": "<div>...</div>",
* },
* {
* "filepath": "/path/to/file2.html",
* "html": "<div>...</div>",
* },
* {
* "filepath": "/path/to/file3.html",
* "html": "<div>...</div>",
* }
* ]
*
*/