@maizzle/framework 4.2.5 → 4.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +5 -5
- package/package.json +6 -6
- package/src/generators/tailwindcss.js +1 -1
- package/src/transformers/filters/index.js +4 -0
- package/src/transformers/index.js +1 -1
- package/src/transformers/inlineCss.js +8 -3
- package/src/transformers/removeInlineSizes.js +2 -3
- package/src/transformers/removeUnusedCss.js +6 -2
package/README.md
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
<div align="center">
|
|
2
2
|
<p>
|
|
3
|
-
<a href="https://maizzle.com
|
|
4
|
-
<
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
3
|
+
<a href="https://maizzle.com" target="_blank">
|
|
4
|
+
<picture>
|
|
5
|
+
<source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/maizzle/framework/HEAD/.github/media/logo-dark.svg">
|
|
6
|
+
<img alt="Maizzle" src="https://raw.githubusercontent.com/maizzle/framework/HEAD/.github/media/logo-light.svg" width="300" height="225" style="max-width: 100%;">
|
|
7
|
+
</picture>
|
|
8
8
|
</a>
|
|
9
9
|
</p>
|
|
10
10
|
<p>Quickly build HTML emails with utility-first CSS</p>
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@maizzle/framework",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.3.1",
|
|
4
4
|
"description": "Maizzle is a framework that helps you quickly build HTML emails with Tailwind CSS.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"main": "src/index.js",
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
],
|
|
42
42
|
"dependencies": {
|
|
43
43
|
"@maizzle/cli": "^1.5.1",
|
|
44
|
-
"autoprefixer": "^10.4.
|
|
44
|
+
"autoprefixer": "^10.4.13",
|
|
45
45
|
"browser-sync": "^2.26.13",
|
|
46
46
|
"color-shorthand-hex-to-six-digit": "^3.0.2",
|
|
47
47
|
"email-comb": "^5.2.0",
|
|
@@ -53,9 +53,9 @@
|
|
|
53
53
|
"juice": "^8.0.0",
|
|
54
54
|
"lodash": "^4.17.20",
|
|
55
55
|
"ora": "^5.1.0",
|
|
56
|
-
"postcss": "^8.4.
|
|
56
|
+
"postcss": "^8.4.19",
|
|
57
57
|
"postcss-import": "^15.0.0",
|
|
58
|
-
"postcss-merge-longhand": "^5.
|
|
58
|
+
"postcss-merge-longhand": "^5.1.7",
|
|
59
59
|
"posthtml": "^0.16.6",
|
|
60
60
|
"posthtml-attrs-parser": "^0.1.1",
|
|
61
61
|
"posthtml-base-url": "^1.0.1",
|
|
@@ -75,10 +75,10 @@
|
|
|
75
75
|
"query-string": "^7.1.0",
|
|
76
76
|
"string-remove-widows": "^2.1.0",
|
|
77
77
|
"string-strip-html": "^8.2.0",
|
|
78
|
-
"tailwindcss": "^3.
|
|
78
|
+
"tailwindcss": "^3.2.4"
|
|
79
79
|
},
|
|
80
80
|
"devDependencies": {
|
|
81
|
-
"ava": "^
|
|
81
|
+
"ava": "^5.1.0",
|
|
82
82
|
"c8": "^7.11.0",
|
|
83
83
|
"np": "*",
|
|
84
84
|
"xo": "0.39.1"
|
|
@@ -113,7 +113,7 @@ module.exports = {
|
|
|
113
113
|
}
|
|
114
114
|
|
|
115
115
|
return postcss([...toProcess])
|
|
116
|
-
.process(css, {from: undefined})
|
|
116
|
+
.process(css, {from: userFileExists ? userFilePath : undefined})
|
|
117
117
|
.then(result => result.css)
|
|
118
118
|
.catch(error => {
|
|
119
119
|
throw new SyntaxError(error)
|
|
@@ -8,6 +8,10 @@ const safeClassNames = require('posthtml-safe-class-names')
|
|
|
8
8
|
const defaultConfig = require('../../generators/posthtml/defaultConfig')
|
|
9
9
|
|
|
10
10
|
module.exports = async (html, config = {}, direct = false) => {
|
|
11
|
+
if (get(config, 'filters') === false) {
|
|
12
|
+
return html
|
|
13
|
+
}
|
|
14
|
+
|
|
11
15
|
const filters = direct ?
|
|
12
16
|
merge(defaultFilters, config) :
|
|
13
17
|
merge(defaultFilters, get(config, 'filters', {}))
|
|
@@ -54,7 +54,7 @@ exports.addURLParams = (html, config) => addURLParams(html, config, true)
|
|
|
54
54
|
exports.preventWidows = (html, config) => preventWidows(html, config)
|
|
55
55
|
exports.replaceStrings = (html, config) => replaceStrings(html, config, true)
|
|
56
56
|
exports.safeClassNames = (html, config) => safeClassNames(html, config, true)
|
|
57
|
-
exports.removeUnusedCSS = (html, config) => removeUnusedCSS(html, config)
|
|
57
|
+
exports.removeUnusedCSS = (html, config) => removeUnusedCSS(html, config, true)
|
|
58
58
|
exports.removeAttributes = (html, config) => removeAttributes(html, config, true)
|
|
59
59
|
exports.attributeToStyle = (html, config) => attributeToStyle(html, config, true)
|
|
60
60
|
exports.removeInlineSizes = (html, config) => removeInlineSizes(html, config, true)
|
|
@@ -7,14 +7,17 @@ module.exports = async (html, config = {}, direct = false) => {
|
|
|
7
7
|
}
|
|
8
8
|
|
|
9
9
|
const options = direct ? config : get(config, 'inlineCSS', {})
|
|
10
|
+
// Default `removeStyleTags` to false so we can preserve
|
|
11
|
+
// CSS selectors that are not present in the HTML
|
|
10
12
|
const removeStyleTags = get(options, 'removeStyleTags', false)
|
|
11
13
|
const css = get(config, 'customCSS', false)
|
|
12
14
|
|
|
13
15
|
if (get(config, 'inlineCSS') === true || !isEmpty(options)) {
|
|
16
|
+
options.applyAttributesTableElements = true
|
|
14
17
|
juice.styleToAttribute = get(options, 'styleToAttribute', {'vertical-align': 'valign'})
|
|
15
18
|
|
|
16
|
-
juice.widthElements = get(options, 'applyWidthAttributes', [])
|
|
17
|
-
juice.heightElements = get(options, 'applyHeightAttributes', [])
|
|
19
|
+
juice.widthElements = get(options, 'applyWidthAttributes', []).map(i => i.toUpperCase())
|
|
20
|
+
juice.heightElements = get(options, 'applyHeightAttributes', []).map(i => i.toUpperCase())
|
|
18
21
|
|
|
19
22
|
juice.excludedProperties = ['--tw-shadow']
|
|
20
23
|
|
|
@@ -28,7 +31,9 @@ module.exports = async (html, config = {}, direct = false) => {
|
|
|
28
31
|
})
|
|
29
32
|
}
|
|
30
33
|
|
|
31
|
-
html = css ?
|
|
34
|
+
html = css ?
|
|
35
|
+
juice.inlineContent(html, css, {removeStyleTags, ...options}) :
|
|
36
|
+
juice(html, {removeStyleTags, ...options})
|
|
32
37
|
|
|
33
38
|
return html
|
|
34
39
|
}
|
|
@@ -19,12 +19,11 @@ module.exports = async (html, config = {}, direct = false) => {
|
|
|
19
19
|
const removeInlineSizes = (mappings = {}) => tree => {
|
|
20
20
|
const process = node => {
|
|
21
21
|
const attrs = parseAttrs(node.attrs)
|
|
22
|
-
const tag = node.tag ? node.tag.toUpperCase() : ''
|
|
23
22
|
|
|
24
23
|
Object.entries(mappings).forEach(([attribute, tags]) => {
|
|
25
|
-
tags = Object.values(tags)
|
|
24
|
+
tags = Object.values(tags).map(tag => tag.toLowerCase())
|
|
26
25
|
|
|
27
|
-
if (!tags.includes(tag)) {
|
|
26
|
+
if (!tags.includes(node.tag)) {
|
|
28
27
|
return node
|
|
29
28
|
}
|
|
30
29
|
|
|
@@ -1,11 +1,15 @@
|
|
|
1
1
|
const {comb} = require('email-comb')
|
|
2
2
|
const {get, merge} = require('lodash')
|
|
3
3
|
|
|
4
|
-
module.exports = async (html, config = {}) => {
|
|
4
|
+
module.exports = async (html, config = {}, direct = false) => {
|
|
5
5
|
if (get(config, 'removeUnusedCSS') === false) {
|
|
6
6
|
return html
|
|
7
7
|
}
|
|
8
8
|
|
|
9
|
+
if (!direct && !get(config, 'removeUnusedCSS')) {
|
|
10
|
+
return html
|
|
11
|
+
}
|
|
12
|
+
|
|
9
13
|
const safelist = [
|
|
10
14
|
'*body*', // Gmail
|
|
11
15
|
'.gmail*', // Gmail
|
|
@@ -13,7 +17,7 @@ module.exports = async (html, config = {}) => {
|
|
|
13
17
|
'.ios*', // Mail on iOS
|
|
14
18
|
'.ox-*', // Open-Xchange
|
|
15
19
|
'.outlook*', // Outlook.com
|
|
16
|
-
'
|
|
20
|
+
'[data-ogs*', // Outlook.com
|
|
17
21
|
'.bloop_container', // Airmail
|
|
18
22
|
'.Singleton', // Apple Mail 10
|
|
19
23
|
'.unused', // Notes 8
|