From 878f12fc93eb7aa41b784cfe99f13d37d2bbff73 Mon Sep 17 00:00:00 2001 From: emrah Date: Wed, 25 Mar 2020 01:43:11 +0100 Subject: [PATCH] Added minify options to MJML (#43223) * added MJMLMinifyOptions to MJMLParsingOpts * revert changes from prettier Co-authored-by: emrah --- types/mjml/index.d.ts | 8 ++++++++ types/mjml/mjml-tests.ts | 3 +++ 2 files changed, 11 insertions(+) diff --git a/types/mjml/index.d.ts b/types/mjml/index.d.ts index c8bd78667a..946d3a8800 100644 --- a/types/mjml/index.d.ts +++ b/types/mjml/index.d.ts @@ -3,6 +3,7 @@ // Definitions by: aahoughton // marpstar // eiskalteschatten +// emrah88 // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped interface MJMLParsingOpts { @@ -12,6 +13,7 @@ interface MJMLParsingOpts { minify?: boolean; validationLevel?: 'strict' | 'soft' | 'skip'; filePath?: string; + minifyOptions?: MJMLMinifyOptions; } interface MJMLParseError { @@ -33,6 +35,12 @@ interface MJMLJsonObject { content?: string; } +interface MJMLMinifyOptions { + collapseWhitespace?: boolean; + minifyCSS?: boolean; + removeEmptyAttributes?: boolean; +} + declare function mjml2html(inp: string | MJMLJsonObject, opts?: MJMLParsingOpts): MJMLParseResults; export = mjml2html; diff --git a/types/mjml/mjml-tests.ts b/types/mjml/mjml-tests.ts index 9c7d47e421..32caa8493b 100644 --- a/types/mjml/mjml-tests.ts +++ b/types/mjml/mjml-tests.ts @@ -12,3 +12,6 @@ const filePath_test = mjml2html("", {filePath: "."}); const jsonObject = {tagName: "mjml", attributes: {width: "100px"}, content: "test content"}; const jsonObject_test = mjml2html(jsonObject); + +const minify_opts_test = mjml2html("