PostHTML CSS Inliner
PostHTML plugin for inlining CSS to style attrs.
Many modern email clients nowadays support CSS in a , so you might not need to inline CSS.
See that discussion.
``js
import posthtml from 'posthtml';
import inlineCSS from 'posthtml-inline-css';
const css = 'div { color: red }';
const result = await posthtml([inlineCSS(css)]).process('
console.log(result.html);
//
$3
`js
import posthtml from 'posthtml';
import inlineCSS from 'posthtml-inline-css';const html = '
Hello!';const result = await posthtml([inlineCSS()]).process(html);
console.log(result.html);
//
Hello!
`$3
`js
import postcss from 'postcss';
import posthtml from 'posthtml';
import inlineCSS from 'posthtml-inline-css';const postcssObj = await postcss(/ some PostCSS plugins /).process('div { color: white }');
const result = await posthtml([inlineCSS(postcssObj)]).process('
Hello!');console.log(result.html);
//
Hello!
``