Skip to content

Commit 670ee44

Browse files
committed
Minify by default, take over beautify & fix warning
1 parent ba8b2c6 commit 670ee44

File tree

3 files changed

+210
-146
lines changed

3 files changed

+210
-146
lines changed

packages/mjml-core/package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,16 +23,16 @@
2323
},
2424
"dependencies": {
2525
"@babel/runtime": "^7.23.9",
26-
"cheerio": "1.0.0-rc.12",
27-
"cssnano": "^7.0.1",
26+
"cheerio": "1.0.0",
27+
"cssnano": "^7.0.6",
2828
"detect-node": "^2.0.4",
2929
"htmlnano": "^2.1.1",
3030
"juice": "^11.0.0",
3131
"lodash": "^4.17.21",
3232
"mjml-parser-xml": "5.0.0-alpha.6",
3333
"mjml-validator": "5.0.0-alpha.6",
34-
"postcss": "^8.4.33",
35-
"prettier": "^3.2.4"
34+
"postcss": "^8.5.3",
35+
"prettier": "^3.5.1"
3636
},
3737
"devDependencies": {
3838
"@babel/cli": "^7.8.4",

packages/mjml-core/src/index.js

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ export default async function mjml2html(mjml, options = {}) {
108108
Ubuntu: 'https://fonts.googleapis.com/css?family=Ubuntu:300,400,500,700',
109109
},
110110
keepComments,
111-
minify = false,
111+
minify = true,
112112
minifyOptions = {},
113113
ignoreIncludes = false,
114114
juiceOptions = {},
@@ -392,22 +392,22 @@ export default async function mjml2html(mjml, options = {}) {
392392

393393
content = mergeOutlookConditionnals(content)
394394

395-
if (beautify) {
396-
content = await prettier.format(content, {
397-
parser: 'html',
398-
printWidth: 240,
399-
})
400-
}
401-
395+
// PostProcessors
402396
if (minify) {
403397
content = await minifier
404398
.process(content, {
405399
collapseWhitespace: true,
406400
minifyCSS: false,
407401
removeEmptyAttributes: true,
402+
minifyJs: false,
408403
...minifyOptions,
409404
})
410405
.then((res) => res.html)
406+
} else if (beautify) {
407+
content = await prettier.format(content, {
408+
parser: 'html',
409+
printWidth: 240,
410+
})
411411
}
412412

413413
return {

0 commit comments

Comments
 (0)