Added minify options to MJML (#43223)

* added MJMLMinifyOptions to MJMLParsingOpts

* revert changes from prettier

Co-authored-by: emrah <ek@infomedia.dk>
This commit is contained in:
emrah 2020-03-25 01:43:11 +01:00 committed by GitHub
parent 4a1d0d6881
commit 878f12fc93
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 0 deletions

View File

@ -3,6 +3,7 @@
// Definitions by: aahoughton <https://github.com/aahoughton>
// marpstar <https://github.com/marpstar>
// eiskalteschatten <https://github.com/eiskalteschatten>
// emrah88 <https://github.com/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;

View File

@ -12,3 +12,6 @@ const filePath_test = mjml2html("<mjml>", {filePath: "."});
const jsonObject = {tagName: "mjml", attributes: {width: "100px"}, content: "test content"};
const jsonObject_test = mjml2html(jsonObject);
const minify_opts_test = mjml2html("<mjml", {minifyOptions: {minifyCSS: true}});
const minify_opts_all_test = mjml2html("<mjml", {minifyOptions: {minifyCSS: true, collapseWhitespace: true, removeEmptyAttributes: true}});