@maizzle/framework 4.3.1 → 4.4.0-beta.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@maizzle/framework",
3
- "version": "4.3.1",
3
+ "version": "4.4.0-beta.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",
@@ -59,6 +59,7 @@
59
59
  "posthtml": "^0.16.6",
60
60
  "posthtml-attrs-parser": "^0.1.1",
61
61
  "posthtml-base-url": "^1.0.1",
62
+ "posthtml-component": "^1.0.0-beta.16",
62
63
  "posthtml-content": "^0.1.0",
63
64
  "posthtml-expressions": "^1.8.1",
64
65
  "posthtml-extend": "^0.6.0",
@@ -3,23 +3,17 @@ const posthtml = require('posthtml')
3
3
  const {get, merge} = require('lodash')
4
4
  const fetch = require('posthtml-fetch')
5
5
  const layouts = require('posthtml-extend')
6
- const modules = require('posthtml-modules')
6
+ const components = require('posthtml-component')
7
7
  const defaultConfig = require('./defaultConfig')
8
- const expressions = require('posthtml-expressions')
9
8
 
10
9
  module.exports = async (html, config) => {
11
10
  const layoutsOptions = get(config, 'build.layouts', {})
12
-
13
- const modulesOptions = get(config, 'build.components', {})
14
- // Fake `from` option so we can reference modules relatively
15
- const modulesRoot = modulesOptions.root || './'
16
- const modulesFrom = modulesOptions.from || `${modulesRoot}/fake`
11
+ const componentsOptions = get(config, 'build.components', {})
12
+ const expressionsOptions = merge({strictMode: false}, get(config, 'build.posthtml.expressions', {}))
17
13
 
18
14
  const posthtmlOptions = merge(defaultConfig, get(config, 'build.posthtml.options', {}))
19
15
  const posthtmlPlugins = get(config, 'build.posthtml.plugins', [])
20
16
 
21
- const expressionsOptions = merge({strictMode: false}, get(config, 'build.posthtml.expressions', {}))
22
-
23
17
  const locals = merge(
24
18
  get(expressionsOptions, 'locals', {}),
25
19
  get(config, 'locals', {}),
@@ -37,7 +31,6 @@ module.exports = async (html, config) => {
37
31
 
38
32
  return posthtml([
39
33
  fetchPlugin,
40
- expressions({...expressionsOptions, locals}),
41
34
  layouts(
42
35
  merge(
43
36
  {
@@ -47,20 +40,20 @@ module.exports = async (html, config) => {
47
40
  layoutsOptions
48
41
  )
49
42
  ),
50
- modules({
51
- expressions: expressionsOptions,
52
- parser: posthtmlOptions,
53
- attributeAsLocals: true,
54
- from: modulesFrom,
55
- root: modulesRoot,
56
- tag: 'component',
57
- attribute: 'src',
58
- plugins: [
59
- fetchPlugin
60
- ],
61
- locals,
62
- ...modulesOptions
63
- }),
43
+ components(
44
+ merge(
45
+ {
46
+ root: componentsOptions.root || './',
47
+ folders: ['src/components', 'src/layouts', 'src/templates'],
48
+ tag: 'component',
49
+ attribute: 'src',
50
+ yield: 'content',
51
+ propsAttribute: 'locals',
52
+ expressions: {...expressionsOptions, locals}
53
+ },
54
+ componentsOptions
55
+ )
56
+ ),
64
57
  ...posthtmlPlugins
65
58
  ])
66
59
  .process(html, {...posthtmlOptions})