From b4cddc5b0f5dd529485ff8579316c9c3c9f3655c Mon Sep 17 00:00:00 2001 From: KMcB Date: Tue, 9 Mar 2021 13:58:57 +0100 Subject: [PATCH 1/2] rm beautify and minify from core --- packages/mjml-core/package.json | 3 --- packages/mjml-core/src/index.js | 25 ++----------------------- 2 files changed, 2 insertions(+), 26 deletions(-) diff --git a/packages/mjml-core/package.json b/packages/mjml-core/package.json index 9e5ad5357..5d4ec3e08 100644 --- a/packages/mjml-core/package.json +++ b/packages/mjml-core/package.json @@ -25,11 +25,8 @@ "@babel/runtime": "^7.8.7", "cheerio": "1.0.0-rc.3", "detect-node": "2.0.4", - "html-minifier": "^4.0.0", - "js-beautify": "^1.6.14", "juice": "^7.0.0", "lodash": "^4.17.15", - "mjml-migrate": "4.9.0", "mjml-parser-xml": "4.9.0", "mjml-validator": "4.9.0" }, diff --git a/packages/mjml-core/src/index.js b/packages/mjml-core/src/index.js index 8191ac2ff..f5288d191 100644 --- a/packages/mjml-core/src/index.js +++ b/packages/mjml-core/src/index.js @@ -11,8 +11,6 @@ import { } from 'lodash' import path from 'path' import juice from 'juice' -import { html as htmlBeautify } from 'js-beautify' -import { minify as htmlMinify } from 'html-minifier' import cheerio from 'cheerio' import MJMLParser from 'mjml-parser-xml' @@ -20,7 +18,6 @@ import MJMLValidator, { dependencies as globalDependencies, assignDependencies, } from 'mjml-validator' -import { handleMjml3 } from 'mjml-migrate' import { initComponent } from './createComponent' import globalComponents, { @@ -109,7 +106,6 @@ export default function mjml2html(mjml, options = {}) { validationLevel = 'soft', filePath = '.', actualPath = '.', - noMigrateWarn = false, preprocessors, presets = [], } = { @@ -135,8 +131,6 @@ export default function mjml2html(mjml, options = {}) { }) } - mjml = handleMjml3(mjml, { noMigrateWarn }) - const globalDatas = { backgroundColor: '', breakpoint: '480px', @@ -362,29 +356,14 @@ export default function mjml2html(mjml, options = {}) { if (beautify) { // eslint-disable-next-line no-console console.warn( - '"beautify" option is deprecated in mjml-core and only available in mjml cli.', + '"beautify" option has been removed in mjml-core and only available in mjml cli.', ) - content = htmlBeautify(content, { - indent_size: 2, - wrap_attributes_indent_size: 2, - max_preserve_newline: 0, - preserve_newlines: false, - }) } - if (minify) { // eslint-disable-next-line no-console console.warn( - '"minify" option is deprecated in mjml-core and only available in mjml cli.', + '"minify" option has been removed in mjml-core and only available in mjml cli.', ) - - content = htmlMinify(content, { - collapseWhitespace: true, - minifyCSS: false, - caseSensitive: true, - removeEmptyAttributes: true, - ...minifyOptions, - }) } return { From 3bcedf38fb8700a6d78606f0db40a36bbeaf6ba0 Mon Sep 17 00:00:00 2001 From: KMcB Date: Tue, 9 Mar 2021 13:59:27 +0100 Subject: [PATCH 2/2] update doc --- README.md | 3 --- doc/install.md | 3 --- packages/mjml/README.md | 3 --- readme-ja.md | 3 --- 4 files changed, 12 deletions(-) diff --git a/README.md b/README.md index f055eebd0..8aa54dee3 100644 --- a/README.md +++ b/README.md @@ -143,13 +143,10 @@ option | unit | description | default value fonts | object | Default fonts imported in the HTML rendered by HTML | See in [index.js](https://github.com/mjmlio/mjml/blob/master/packages/mjml-core/src/index.js#L36-L44) keepComments | boolean | Option to keep comments in the HTML output | true ignoreIncludes | boolean | Option to ignore mj-includes | false -beautify | boolean | Option to beautify the HTML output | false -minify | boolean | Option to minify the HTML output | false validationLevel | string | Available values for the [validator](https://github.com/mjmlio/mjml/tree/master/packages/mjml-validator#validating-mjml): 'strict', 'soft', 'skip' | 'soft' filePath | string | Path of file, used for relative paths in mj-includes | '.' preprocessors | array of functions | Preprocessors applied to the xml before parsing. Input must be xml, not json. Functions must be (xml: string) => string | [] juicePreserveTags | Preserve some tags when inlining css, see [mjml-cli documentation](https://github.com/mjmlio/mjml/blob/master/packages/mjml-cli/README.md) for more info | NA -minifyOptions | Options for html minifier, see [mjml-cli documentation](https://github.com/mjmlio/mjml/blob/master/packages/mjml-cli/README.md) for more info | NA mjmlConfigPath | string | The path or directory of the `.mjmlconfig` file (for custom components use) | `process.cwd()` useMjmlConfigOptions | Allows to use the `config` attribute from `.mjmlconfig` file | false diff --git a/doc/install.md b/doc/install.md index 21e106b29..bca4c1880 100644 --- a/doc/install.md +++ b/doc/install.md @@ -100,13 +100,10 @@ option | unit | description | default value -------------|--------|--------------|--------------- fonts | object | Default fonts imported in the HTML rendered by HTML | See in [index.js](https://github.com/mjmlio/mjml/blob/master/packages/mjml-core/src/index.js#L36-L44) keepComments | boolean | Option to keep comments in the HTML output | true -beautify | boolean | Option to beautify the HTML output | false -minify | boolean | Option to minify the HTML output | false validationLevel | string | Available values for the [validator](https://github.com/mjmlio/mjml/tree/master/packages/mjml-validator#validating-mjml): 'strict', 'soft', 'skip' | 'soft' filePath | string | Full path of the specified file to use when resolving paths from [`mj-include` components](#mj-include) | '.' mjmlConfigPath | string | The path or directory of the [`.mjmlconfig` file](#community-components) | `process.cwd()` useMjmlConfigOptions | Allows to use the `config` attribute from `.mjmlconfig` file | false -minifyOptions | Options for html minifier, see [mjml-cli documentation](https://github.com/mjmlio/mjml/blob/master/packages/mjml-cli/README.md) for more info | {"collapseWhitespace": true, "minifyCSS": false, "removeEmptyAttributes": true} juicePreserveTags | optional setting when inlining css, see [mjml-cli documentation](https://github.com/mjmlio/mjml/blob/master/packages/mjml-cli/README.md) for more info | NA ## API diff --git a/packages/mjml/README.md b/packages/mjml/README.md index 4a9cb6ac9..405a9b0aa 100644 --- a/packages/mjml/README.md +++ b/packages/mjml/README.md @@ -123,13 +123,10 @@ option | unit | description | default value fonts | object | Default fonts imported in the HTML rendered by HTML | See in [index.js](https://github.com/mjmlio/mjml/blob/master/packages/mjml-core/src/index.js#L36-L44) keepComments | boolean | Option to keep comments in the HTML output | true ignoreIncludes | boolean | Option to ignore mj-includes | false -beautify | boolean | Option to beautify the HTML output | false -minify | boolean | Option to minify the HTML output | false validationLevel | string | Available values for the [validator](https://github.com/mjmlio/mjml/tree/master/packages/mjml-validator#validating-mjml): 'strict', 'soft', 'skip' | 'soft' filePath | string | Path of file, used for relative paths in mj-includes | '.' preprocessors | array of functions | Preprocessors applied to the xml before parsing. Input must be xml, not json. Functions must be (xml: string) => string | [] juicePreserveTags | Preserve some tags when inlining css, see [mjml-cli documentation](https://github.com/mjmlio/mjml/blob/master/packages/mjml-cli/README.md) for more info | NA -minifyOptions | Options for html minifier, see [mjml-cli documentation](https://github.com/mjmlio/mjml/blob/master/packages/mjml-cli/README.md) for more info | NA mjmlConfigPath | string | The path or directory of the `.mjmlconfig` file (for custom components use) | `process.cwd()` useMjmlConfigOptions | Allows to use the `config` attribute from `.mjmlconfig` file | false diff --git a/readme-ja.md b/readme-ja.md index 136a23f8a..43022ac7a 100644 --- a/readme-ja.md +++ b/readme-ja.md @@ -143,13 +143,10 @@ console.log(htmlOutput) fonts | object | 初期フォントをインポートしたHTMLを描画する | 初期フォントについては[index.js](https://github.com/mjmlio/mjml/blob/master/packages/mjml-core/src/index.js#L36-L44)をご覧ください。 keepComments | boolean | 出力されるHTMLにコメントを残すオプション | true ignoreIncludes | boolean | mj-includesを無視するオプション | false -beautify | boolean | 出力されるHTMLを整えるオプション | false -minify | boolean | 出力されるHTMLをminify化するオプション | false validationLevel | string | [validator](https://github.com/mjmlio/mjml/tree/master/packages/mjml-validator#validating-mjml)で利用する値: 'strict', 'soft', 'skip' | 'soft' filePath | string | mj-includesの相対パスに使われるファイルパス | '.' preprocessors | array of functions | xmlのパース前に適用するプリプロセッサー。入力はjsonではなく、必ずxmlでなければなりません。関数の場合は必ず (xml: string) => string としなければなりません。 | [] juicePreserveTags | cssをインライン化する際にタグを保持する。詳しくは[mjml-cli documentation](https://github.com/mjmlio/mjml/blob/master/packages/mjml-cli/README.md)をご覧ください。 | NA -minifyOptions | htmlのminify化に関するオプション。詳しくは[mjml-cli documentation](https://github.com/mjmlio/mjml/blob/master/packages/mjml-cli/README.md)をご覧ください。 | NA mjmlConfigPath | string | `.mjmlconfig`ファイルのパスもしくはディレクトリー(カスタムコンポーネントの場合) | `process.cwd()` useMjmlConfigOptions | `.mjmlconfig`ファイルで`config`属性の使用を許可する | false