18 lines
479 B
TypeScript
18 lines
479 B
TypeScript
import { logger } from "./logger.utils";
|
|
|
|
const htmlShrink = require("html-minifier").minify;
|
|
const juice = require("juice");
|
|
|
|
// Inlines styles and minifies the inlined HTML
|
|
async function minifyMail(input: string): Promise<string> {
|
|
logger.trace("minifyMail: Minifying mail output")
|
|
const inlined: string = juice(input);
|
|
return htmlShrink(inlined, {
|
|
removeComments: true,
|
|
collapseWhitespace: true,
|
|
});
|
|
}
|
|
|
|
module.exports = { minifyMail };
|
|
export { minifyMail };
|