chore: Move from inline-css -> css-inline (#6252)

This commit is contained in:
Tom Moor
2023-12-05 20:40:27 -05:00
committed by GitHub
parent b6f0d44dee
commit 5558d5af95
6 changed files with 42 additions and 360 deletions

View File

@@ -0,0 +1,20 @@
import { inline } from "css-inline";
import env from "@server/env";
export default class HTMLHelper {
/**
* Move CSS styles from <style> tags to inline styles with default settings.
*
* @param html The HTML to inline CSS styles for.
* @returns The HTML with CSS styles inlined.
*/
public static inlineCSS(html: string): string {
return inline(html, {
base_url: env.URL,
inline_style_tags: true,
keep_link_tags: false,
keep_style_tags: false,
load_remote_stylesheets: false,
});
}
}