@maizzle/framework 4.4.5 → 4.4.7

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@maizzle/framework",
3
- "version": "4.4.5",
3
+ "version": "4.4.7",
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",
@@ -78,7 +78,7 @@
78
78
  },
79
79
  "devDependencies": {
80
80
  "ava": "^5.2.0",
81
- "c8": "^7.13.0",
81
+ "c8": "^8.0.0",
82
82
  "np": "*",
83
83
  "xo": "0.39.1"
84
84
  },
@@ -14,14 +14,20 @@ module.exports = async (html, config = {}, direct = false) => {
14
14
  table: {
15
15
  cellpadding: 0,
16
16
  cellspacing: 0,
17
- role: 'presentation'
17
+ role: 'none'
18
18
  },
19
19
  img: {
20
20
  alt: ''
21
21
  }
22
22
  }
23
23
 
24
- attributes = direct ? {...attributes, ...config} : (isObject(config.extraAttributes) ? {...attributes, ...config.extraAttributes} : attributes)
24
+ attributes = direct
25
+ ? {...attributes, ...config}
26
+ : (
27
+ isObject(config.extraAttributes)
28
+ ? {...attributes, ...config.extraAttributes}
29
+ : attributes
30
+ )
25
31
 
26
32
  return posthtml([addAttributes({attributes})]).process(html, posthtmlOptions).then(result => result.html)
27
33
  }
@@ -30,7 +30,7 @@ module.exports = async (html, config = {}, direct = false) => {
30
30
  config: merge({
31
31
  build: {
32
32
  tailwind: {
33
- config: get(config, 'build.tailwind.config', {})
33
+ config: get(config, 'build.tailwind.config', 'tailwind.config.js')
34
34
  }
35
35
  }
36
36
  }, maizzleConfig)
@@ -41,7 +41,11 @@ module.exports = async (html, config = {}, direct = false) => {
41
41
  posthtmlContent(filters)
42
42
  ]
43
43
 
44
- if (get(config, 'safeClassNames') !== false) {
44
+ /**
45
+ * Run `safeClassNames` in filters only when not when developing locally and
46
+ * `safeClassNames` is not explicitly disabled (set to `false`).
47
+ */
48
+ if (get(config, 'env') !== 'local' && get(config, 'safeClassNames') !== false) {
45
49
  posthtmlPlugins.push(safeClassNames({
46
50
  replacements: {
47
51
  '{': '{',
@@ -1,20 +1,21 @@
1
1
  const posthtml = require('posthtml')
2
- const {get, merge} = require('lodash')
2
+ const {get, merge, isEmpty} = require('lodash')
3
3
  const safeClassNames = require('posthtml-safe-class-names')
4
4
  const defaultConfig = require('../generators/posthtml/defaultConfig')
5
5
 
6
6
  module.exports = async (html, config = {}, direct = false) => {
7
- const option = get(config, 'safeClassNames')
8
-
9
- if (option === false) {
10
- return html
11
- }
12
-
13
7
  /*
14
- * Setting it to `true` in the config will run `safeClassNames`
15
- * no matter the environment.
8
+ * Don't run when:
9
+ * - `config` is falsy or empty
10
+ * - developing locally and `safeClassNames` is not explicitly `true`
11
+ * - `safeClassNames` is explicitly `false`
16
12
  */
17
- if (config.env === 'local' && !option) {
13
+ if (
14
+ !config
15
+ || isEmpty(config)
16
+ || (get(config, 'env') === 'local' && get(config, 'safeClassNames') !== true)
17
+ || get(config, 'safeClassNames') === false
18
+ ) {
18
19
  return html
19
20
  }
20
21