@maizzle/framework 4.0.0-alpha.6 → 4.0.0-alpha.9

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.
Files changed (60) hide show
  1. package/.github/workflows/nodejs.yml +1 -1
  2. package/bin/maizzle +3 -0
  3. package/package.json +12 -7
  4. package/src/commands/serve.js +36 -19
  5. package/src/generators/output/to-string.js +71 -71
  6. package/src/generators/postcss.js +29 -0
  7. package/src/generators/posthtml.js +66 -61
  8. package/src/generators/tailwindcss.js +1 -1
  9. package/src/index.js +17 -13
  10. package/src/transformers/baseUrl.js +33 -9
  11. package/src/transformers/filters/defaultFilters.js +126 -0
  12. package/src/transformers/filters/index.js +55 -0
  13. package/src/transformers/index.js +60 -57
  14. package/src/transformers/inlineCss.js +1 -1
  15. package/src/transformers/minify.js +1 -1
  16. package/src/transformers/prettify.js +29 -20
  17. package/src/transformers/removeInlineBackgroundColor.js +1 -1
  18. package/src/transformers/removeInlinedSelectors.js +70 -0
  19. package/src/transformers/removeUnusedCss.js +40 -20
  20. package/src/transformers/sixHex.js +24 -1
  21. package/test/expected/posthtml/component.html +13 -0
  22. package/test/expected/{inheritance.html → posthtml/extend-template.html} +2 -2
  23. package/test/expected/posthtml/fetch.html +5 -0
  24. package/test/expected/posthtml/layout.html +3 -0
  25. package/test/expected/transformers/atimport-in-style.html +16 -0
  26. package/test/expected/transformers/{base-image-url.html → base-url.html} +18 -2
  27. package/test/expected/transformers/filters.html +81 -0
  28. package/test/expected/transformers/preserve-transform-css.html +48 -0
  29. package/test/expected/useConfig.html +9 -9
  30. package/test/fixtures/basic.html +6 -6
  31. package/test/fixtures/posthtml/component.html +19 -0
  32. package/test/fixtures/{inheritance.html → posthtml/extend-template.html} +7 -7
  33. package/test/fixtures/posthtml/fetch.html +9 -0
  34. package/test/fixtures/posthtml/layout.html +11 -0
  35. package/test/fixtures/transformers/atimport-in-style.html +11 -0
  36. package/test/fixtures/transformers/{base-image-url.html → base-url.html} +18 -2
  37. package/test/fixtures/transformers/filters.html +87 -0
  38. package/test/fixtures/transformers/preserve-transform-css.html +25 -0
  39. package/test/fixtures/useConfig.html +9 -9
  40. package/test/stubs/components/component.html +5 -0
  41. package/test/stubs/data.json +14 -0
  42. package/test/stubs/layouts/basic.html +1 -0
  43. package/test/stubs/{layout.html → layouts/full.html} +0 -0
  44. package/test/stubs/{layout-basic.html → layouts/template.html} +5 -5
  45. package/test/stubs/post.css +6 -0
  46. package/test/stubs/tailwind/{preserve.html → content-source.html} +0 -0
  47. package/test/stubs/tailwind/tailwind.css +3 -0
  48. package/test/stubs/template.html +10 -10
  49. package/test/stubs/templates/1.html +1 -1
  50. package/test/stubs/templates/2.test +1 -0
  51. package/test/test-postcss.js +8 -0
  52. package/test/test-posthtml.js +66 -0
  53. package/test/{test-tailwind.js → test-tailwindcss.js} +4 -4
  54. package/test/test-todisk.js +43 -29
  55. package/test/test-tostring.js +32 -16
  56. package/test/test-transformers.js +173 -26
  57. package/src/transformers/transform.js +0 -22
  58. package/test/expected/transformers/transform-postcss.html +0 -19
  59. package/test/stubs/templates/2.html +0 -1
  60. package/test/stubs/templates/3.mzl +0 -1
@@ -14,7 +14,7 @@ jobs:
14
14
 
15
15
  strategy:
16
16
  matrix:
17
- node-version: [12, 14, 16]
17
+ node-version: [14, 16, 17]
18
18
 
19
19
  steps:
20
20
  - uses: actions/checkout@v2
package/bin/maizzle ADDED
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env node
2
+
3
+ require('@maizzle/cli')
package/package.json CHANGED
@@ -1,9 +1,12 @@
1
1
  {
2
2
  "name": "@maizzle/framework",
3
- "version": "4.0.0-alpha.6",
3
+ "version": "4.0.0-alpha.9",
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",
7
+ "bin": {
8
+ "maizzle": "bin/maizzle"
9
+ },
7
10
  "repository": {
8
11
  "type": "git",
9
12
  "url": "https://github.com/maizzle/framework.git"
@@ -33,10 +36,11 @@
33
36
  "release": "np"
34
37
  },
35
38
  "dependencies": {
39
+ "@maizzle/cli": "^1.4.0",
36
40
  "autoprefixer": "^10.4.0",
37
41
  "browser-sync": "^2.26.13",
38
42
  "color-shorthand-hex-to-six-digit": "^3.0.2",
39
- "email-comb": "^5.0.0",
43
+ "email-comb": "^5.2.0",
40
44
  "front-matter": "^4.0.0",
41
45
  "fs-extra": "^10.0.0",
42
46
  "glob-promise": "^4.1.0",
@@ -51,17 +55,18 @@
51
55
  "posthtml": "^0.16.6",
52
56
  "posthtml-attrs-parser": "^0.1.1",
53
57
  "posthtml-base-url": "^1.0.1",
54
- "posthtml-content": "^0.0.3",
58
+ "posthtml-content": "^0.1.0",
55
59
  "posthtml-expressions": "^1.8.1",
56
60
  "posthtml-extend": "^0.6.0",
57
61
  "posthtml-extra-attributes": "^1.0.0",
58
- "posthtml-fetch": "^2.0.0",
62
+ "posthtml-fetch": "^2.2.0",
59
63
  "posthtml-markdownit": "^1.3.0",
60
- "posthtml-modules": "^0.8.0",
64
+ "posthtml-match-helper": "^1.0.3",
65
+ "posthtml-modules": "^0.9.0",
61
66
  "posthtml-mso": "^1.0.4",
62
67
  "posthtml-postcss-merge-longhand": "^1.0.2",
63
68
  "posthtml-remove-attributes": "^1.0.0",
64
- "posthtml-safe-class-names": "^1.0.4",
69
+ "posthtml-safe-class-names": "^1.0.8",
65
70
  "posthtml-url-parameters": "^1.0.4",
66
71
  "pretty": "^2.0.0",
67
72
  "prevent-widows": "^1.0.2",
@@ -76,7 +81,7 @@
76
81
  "xo": "0.39.1"
77
82
  },
78
83
  "engines": {
79
- "node": ">=12.13.0"
84
+ "node": ">=14.0.0"
80
85
  },
81
86
  "ava": {
82
87
  "files": [
@@ -41,13 +41,27 @@ const serve = async (env = 'local', config = {}) => {
41
41
  const globalPaths = [
42
42
  'src/**',
43
43
  get(config, 'build.tailwind.config', 'tailwind.config.js'),
44
- [...new Set(get(config, 'build.browsersync.watch', []))]
44
+ ...new Set(get(config, 'build.browsersync.watch', []))
45
45
  ]
46
46
 
47
47
  // Watch for Template file changes
48
48
  browsersync()
49
49
  .watch(templatePaths)
50
50
  .on('change', async file => {
51
+ if (config.events && typeof config.events.beforeCreate === 'function') {
52
+ await config.events.beforeCreate(config)
53
+ }
54
+
55
+ // Don't render if file type is not configured
56
+ // eslint-disable-next-line
57
+ const filetypes = templates.reduce((acc, template) => {
58
+ return [...acc, ...get(template, 'filetypes', ['html'])]
59
+ }, [])
60
+
61
+ if (!filetypes.includes(path.extname(file).slice(1))) {
62
+ return
63
+ }
64
+
51
65
  if (get(config, 'build.console.clear')) {
52
66
  clearConsole()
53
67
  }
@@ -58,10 +72,6 @@ const serve = async (env = 'local', config = {}) => {
58
72
 
59
73
  file = file.replace(/\\/g, '/')
60
74
 
61
- if (config.events && typeof config.events.beforeCreate === 'function') {
62
- await config.events.beforeCreate(config)
63
- }
64
-
65
75
  const renderOptions = {
66
76
  maizzle: config,
67
77
  ...config.events
@@ -72,19 +82,23 @@ const serve = async (env = 'local', config = {}) => {
72
82
  renderOptions
73
83
  )
74
84
  .then(async ({html, config}) => {
85
+ let source = ''
75
86
  let dest = ''
76
87
  let ext = ''
77
88
 
78
89
  if (Array.isArray(config.build.templates)) {
79
90
  const match = config.build.templates.find(template => template.source === path.parse(file).dir)
91
+ source = get(match, 'source')
80
92
  dest = get(match, 'destination.path', 'build_local')
81
93
  ext = get(match, 'destination.ext', 'html')
82
94
  } else if (isObject(config.build.templates)) {
95
+ source = get(config, 'build.templates.source')
83
96
  dest = get(config, 'build.templates.destination.path', 'build_local')
84
97
  ext = get(config, 'build.templates.destination.ext', 'html')
85
98
  }
86
99
 
87
- const finalDestination = path.join(dest, `${path.parse(file).name}.${ext}`)
100
+ const fileDir = path.parse(file).dir.replace(source, '')
101
+ const finalDestination = path.join(dest, fileDir, `${path.parse(file).name}.${ext}`)
88
102
 
89
103
  await fs.outputFile(config.permalink || finalDestination, html)
90
104
  })
@@ -117,19 +131,22 @@ const serve = async (env = 'local', config = {}) => {
117
131
 
118
132
  // Initialize Browsersync
119
133
  browsersync()
120
- .init({
121
- notify: false,
122
- open: false,
123
- port: 3000,
124
- server: {
125
- baseDir,
126
- directory: true
127
- },
128
- tunnel: false,
129
- ui: {port: 3001},
130
- logFileChanges: false,
131
- ...get(config, 'build.browsersync', {})
132
- }, () => {})
134
+ .init(
135
+ merge(
136
+ {
137
+ notify: false,
138
+ open: false,
139
+ port: 3000,
140
+ server: {
141
+ baseDir,
142
+ directory: true
143
+ },
144
+ tunnel: false,
145
+ ui: {port: 3001},
146
+ logFileChanges: false
147
+ },
148
+ get(config, 'build.browsersync', {})
149
+ ), () => {})
133
150
  } catch (error) {
134
151
  spinner.fail(error)
135
152
  throw error
@@ -1,71 +1,71 @@
1
- const fm = require('front-matter')
2
- const {get, merge} = require('lodash')
3
- const posthtml = require('../posthtml')
4
- const Tailwind = require('../tailwindcss')
5
- const Transformers = require('../../transformers')
6
- const posthtmlMSO = require('../../transformers/posthtmlMso')
7
- const Config = require('../config')
8
-
9
- module.exports = async (html, options) => {
10
- process.env.NODE_ENV = get(options, 'maizzle.env', 'local')
11
-
12
- if (typeof html !== 'string') {
13
- throw new TypeError(`first argument must be an HTML string, received ${html}`)
14
- }
15
-
16
- if (html.length === 0) {
17
- throw new RangeError('received empty string')
18
- }
19
-
20
- const fileConfig = await Config.getMerged(process.env.NODE_ENV)
21
-
22
- let config = merge(fileConfig, get(options, 'maizzle', {}))
23
-
24
- const tailwindConfig = get(options, 'tailwind.config', {})
25
- const cssString = get(options, 'tailwind.css', '@tailwind components; @tailwind utilities;')
26
-
27
- let {frontmatter} = fm(html)
28
-
29
- if (frontmatter) {
30
- frontmatter = await posthtml(frontmatter, config)
31
- }
32
-
33
- html = `---\n${frontmatter}\n---\n\n${fm(html).body}`
34
-
35
- config = merge({applyTransformers: true}, config, fm(html).attributes)
36
-
37
- if (typeof get(options, 'tailwind.compiled') === 'string') {
38
- config.css = options.tailwind.compiled
39
- } else {
40
- config.css = await Tailwind.compile(cssString, html, tailwindConfig, config)
41
- }
42
-
43
- if (options && typeof options.beforeRender === 'function') {
44
- html = await options.beforeRender(html, config)
45
- }
46
-
47
- html = await posthtml(html, config)
48
-
49
- while (Object.keys(fm(html).attributes).length > 0) {
50
- html = fm(html).body
51
- }
52
-
53
- if (options && typeof options.afterRender === 'function') {
54
- html = await options.afterRender(html, config)
55
- }
56
-
57
- if (config.applyTransformers) {
58
- html = await Transformers.process(html, config)
59
- }
60
-
61
- if (options && typeof options.afterTransformers === 'function') {
62
- html = await options.afterTransformers(html, config)
63
- }
64
-
65
- html = await posthtmlMSO(html, config)
66
-
67
- return {
68
- html,
69
- config
70
- }
71
- }
1
+ const fm = require('front-matter')
2
+ const {get, merge} = require('lodash')
3
+ const posthtml = require('../posthtml')
4
+ const Tailwind = require('../tailwindcss')
5
+ const Transformers = require('../../transformers')
6
+ const posthtmlMSO = require('../../transformers/posthtmlMso')
7
+ const Config = require('../config')
8
+
9
+ module.exports = async (html, options) => {
10
+ process.env.NODE_ENV = get(options, 'maizzle.env', 'local')
11
+
12
+ if (typeof html !== 'string') {
13
+ throw new TypeError(`first argument must be an HTML string, received ${html}`)
14
+ }
15
+
16
+ if (html.length === 0) {
17
+ throw new RangeError('received empty string')
18
+ }
19
+
20
+ const fileConfig = await Config.getMerged(process.env.NODE_ENV)
21
+
22
+ let config = merge(fileConfig, get(options, 'maizzle', {}))
23
+
24
+ const tailwindConfig = get(options, 'tailwind.config', {})
25
+ const cssString = get(options, 'tailwind.css', '')
26
+
27
+ let {frontmatter} = fm(html)
28
+
29
+ if (frontmatter) {
30
+ frontmatter = await posthtml(frontmatter, config)
31
+ }
32
+
33
+ html = `---\n${frontmatter}\n---\n\n${fm(html).body}`
34
+
35
+ config = merge({applyTransformers: true}, config, fm(html).attributes)
36
+
37
+ if (typeof get(options, 'tailwind.compiled') === 'string') {
38
+ config.css = options.tailwind.compiled
39
+ } else {
40
+ config.css = await Tailwind.compile(cssString, html, tailwindConfig, config)
41
+ }
42
+
43
+ if (options && typeof options.beforeRender === 'function') {
44
+ html = await options.beforeRender(html, config)
45
+ }
46
+
47
+ html = await posthtml(html, config)
48
+
49
+ while (Object.keys(fm(html).attributes).length > 0) {
50
+ html = fm(html).body
51
+ }
52
+
53
+ if (options && typeof options.afterRender === 'function') {
54
+ html = await options.afterRender(html, config)
55
+ }
56
+
57
+ if (config.applyTransformers) {
58
+ html = await Transformers.process(html, config)
59
+ }
60
+
61
+ if (options && typeof options.afterTransformers === 'function') {
62
+ html = await options.afterTransformers(html, config)
63
+ }
64
+
65
+ html = await posthtmlMSO(html, config)
66
+
67
+ return {
68
+ html,
69
+ config
70
+ }
71
+ }
@@ -0,0 +1,29 @@
1
+ const path = require('path')
2
+ const {get} = require('lodash')
3
+ const postcss = require('postcss')
4
+ const postcssImport = require('postcss-import')
5
+ const postcssNested = require('tailwindcss/nesting')
6
+ const mergeLonghand = require('postcss-merge-longhand')
7
+
8
+ module.exports = {
9
+ process: async (css = '', maizzleConfig = {}, spinner = null) => {
10
+ const userFilePath = get(maizzleConfig, 'build.tailwind.css', path.join(process.cwd(), 'src/css/tailwind.css'))
11
+
12
+ return postcss([
13
+ postcssImport({path: path.dirname(userFilePath)}),
14
+ postcssNested(),
15
+ maizzleConfig.env === 'local' ? () => {} : mergeLonghand(),
16
+ ...get(maizzleConfig, 'build.postcss.plugins', [])
17
+ ])
18
+ .process(css, {from: undefined})
19
+ .then(result => result.css)
20
+ .catch(error => {
21
+ console.error(error)
22
+ if (spinner) {
23
+ spinner.stop()
24
+ }
25
+
26
+ throw new Error(`PostCSS processing failed`)
27
+ })
28
+ }
29
+ }
@@ -1,61 +1,66 @@
1
- const fm = require('front-matter')
2
- const posthtml = require('posthtml')
3
- const {get, merge} = require('lodash')
4
- const fetch = require('posthtml-fetch')
5
- const layouts = require('posthtml-extend')
6
- const modules = require('posthtml-modules')
7
- const expressions = require('posthtml-expressions')
8
-
9
- module.exports = async (html, config) => {
10
- const layoutsOptions = get(config, 'build.layouts', {})
11
-
12
- const fetchOptions = get(config, 'build.posthtml.fetch', {})
13
- const fetchPlugin = fetch({...fetchOptions})
14
-
15
- const modulesOptions = get(config, 'build.components', {})
16
- // Fake `from` option so we can reference modules relatively
17
- const modulesRoot = modulesOptions.root || './'
18
- const modulesFrom = modulesOptions.from || `${modulesRoot}/fake`
19
-
20
- const posthtmlOptions = get(config, 'build.posthtml.options', {})
21
- const posthtmlPlugins = get(config, 'build.posthtml.plugins', [])
22
-
23
- const expressionsOptions = merge({strictMode: false}, get(config, 'build.posthtml.expressions', {}))
24
-
25
- const locals = merge(
26
- get(expressionsOptions, 'locals', {}),
27
- get(config, 'locals', {}),
28
- {page: config}
29
- )
30
-
31
- return posthtml([
32
- fetchPlugin,
33
- layouts(
34
- merge(
35
- {
36
- strict: false,
37
- plugins: [
38
- expressions({...expressionsOptions, locals})
39
- ]
40
- },
41
- layoutsOptions
42
- )
43
- ),
44
- modules({
45
- parser: posthtmlOptions,
46
- attributeAsLocals: true,
47
- from: modulesFrom,
48
- root: modulesRoot,
49
- tag: 'component',
50
- attribute: 'src',
51
- plugins: [
52
- fetchPlugin
53
- ],
54
- locals,
55
- ...modulesOptions
56
- }),
57
- ...posthtmlPlugins
58
- ])
59
- .process(html, {...posthtmlOptions})
60
- .then(result => fm(result.html).body)
61
- }
1
+ const fm = require('front-matter')
2
+ const posthtml = require('posthtml')
3
+ const {get, merge} = require('lodash')
4
+ const fetch = require('posthtml-fetch')
5
+ const layouts = require('posthtml-extend')
6
+ const modules = require('posthtml-modules')
7
+ const expressions = require('posthtml-expressions')
8
+
9
+ module.exports = async (html, config) => {
10
+ const layoutsOptions = get(config, 'build.layouts', {})
11
+
12
+ const modulesOptions = get(config, 'build.components', {})
13
+ // Fake `from` option so we can reference modules relatively
14
+ const modulesRoot = modulesOptions.root || './'
15
+ const modulesFrom = modulesOptions.from || `${modulesRoot}/fake`
16
+
17
+ const posthtmlOptions = get(config, 'build.posthtml.options', {})
18
+ const posthtmlPlugins = get(config, 'build.posthtml.plugins', [])
19
+
20
+ const expressionsOptions = merge({strictMode: false}, get(config, 'build.posthtml.expressions', {}))
21
+
22
+ const locals = merge(
23
+ get(expressionsOptions, 'locals', {}),
24
+ get(config, 'locals', {}),
25
+ {page: config}
26
+ )
27
+
28
+ const fetchPlugin = fetch(
29
+ merge(
30
+ {
31
+ expressions: merge({...expressionsOptions, locals})
32
+ },
33
+ get(config, 'build.posthtml.fetch', {})
34
+ )
35
+ )
36
+
37
+ return posthtml([
38
+ fetchPlugin,
39
+ expressions({...expressionsOptions, locals}),
40
+ layouts(
41
+ merge(
42
+ {
43
+ strict: false,
44
+ expressions: merge({...expressionsOptions, locals})
45
+ },
46
+ layoutsOptions
47
+ )
48
+ ),
49
+ modules({
50
+ parser: posthtmlOptions,
51
+ attributeAsLocals: true,
52
+ from: modulesFrom,
53
+ root: modulesRoot,
54
+ tag: 'component',
55
+ attribute: 'src',
56
+ plugins: [
57
+ fetchPlugin
58
+ ],
59
+ locals,
60
+ ...modulesOptions
61
+ }),
62
+ ...posthtmlPlugins
63
+ ])
64
+ .process(html, {...posthtmlOptions})
65
+ .then(result => fm(result.html).body)
66
+ }
@@ -92,7 +92,7 @@ module.exports = {
92
92
  if (userFileExists) {
93
93
  css = await fs.readFile(path.resolve(userFilePath), 'utf8') + css
94
94
  } else {
95
- css = '@import "tailwindcss/components"; @import "tailwindcss/utilities";' + css
95
+ css = `@import "tailwindcss/components"; @import "tailwindcss/utilities"; ${css}`
96
96
  }
97
97
 
98
98
  return postcss([
package/src/index.js CHANGED
@@ -1,13 +1,17 @@
1
- const serve = require('./commands/serve')
2
- const toFile = require('./commands/build')
3
- const transformers = require('./transformers')
4
- const toString = require('./functions/render')
5
- const toPlaintext = require('./functions/plaintext')
6
-
7
- module.exports = {
8
- serve,
9
- build: toFile,
10
- ...transformers,
11
- render: toString,
12
- plaintext: toPlaintext
13
- }
1
+ const serve = require('./commands/serve')
2
+ const toFile = require('./commands/build')
3
+ const transformers = require('./transformers')
4
+ const toString = require('./functions/render')
5
+ const PostCSS = require('./generators/postcss')
6
+ const toPlaintext = require('./functions/plaintext')
7
+ const TailwindCSS = require('./generators/tailwindcss')
8
+
9
+ module.exports = {
10
+ serve,
11
+ build: toFile,
12
+ ...transformers,
13
+ render: toString,
14
+ postcss: PostCSS,
15
+ plaintext: toPlaintext,
16
+ tailwindcss: TailwindCSS
17
+ }
@@ -3,17 +3,41 @@ const isUrl = require('is-url-superb')
3
3
  const baseUrl = require('posthtml-base-url')
4
4
  const {get, isObject, isEmpty} = require('lodash')
5
5
 
6
- // VML backgrounds need regex because they're inside HTML comments :(
6
+ /**
7
+ * VML backgrounds must be handled with regex because
8
+ * they're inside HTML comments.
9
+ */
7
10
  const rewriteVMLs = (html, url) => {
8
- const vImageMatch = html.match(/(<v:image.+)(src=['"]([^'"]+)['"])/)
9
- const vFillMatch = html.match(/(<v:fill.+)(src=['"]([^'"]+)['"])/)
11
+ // Handle <v:image>
12
+ const vImageMatches = html.match(/<v:image[^>]+src="?([^"\s]+)"/g)
10
13
 
11
- if (vImageMatch && !isUrl(vImageMatch[3])) {
12
- html = html.replace(vImageMatch[0], `${vImageMatch[1]}src="${url}${vImageMatch[3]}"`)
14
+ if (vImageMatches) {
15
+ vImageMatches.forEach(match => {
16
+ const vImage = match.match(/<v:image[^>]+src="?([^"\s]+)"/)
17
+ const vImageSrc = vImage[1]
18
+
19
+ if (!isUrl(vImageSrc)) {
20
+ const vImageSrcUrl = url + vImageSrc
21
+ const vImageReplace = vImage[0].replace(vImageSrc, vImageSrcUrl)
22
+ html = html.replace(vImage[0], vImageReplace)
23
+ }
24
+ })
13
25
  }
14
26
 
15
- if (vFillMatch && !isUrl(vFillMatch[3])) {
16
- html = html.replace(vFillMatch[0], `${vFillMatch[1]}src="${url}${vFillMatch[3]}"`)
27
+ // Handle <v:fill>
28
+ const vFillMatches = html.match(/<v:fill[^>]+src="?([^"\s]+)"/g)
29
+
30
+ if (vFillMatches) {
31
+ vFillMatches.forEach(match => {
32
+ const vFill = match.match(/<v:fill[^>]+src="?([^"\s]+)"/)
33
+ const vFillSrc = vFill[1]
34
+
35
+ if (!isUrl(vFillSrc)) {
36
+ const vFillSrcUrl = url + vFillSrc
37
+ const vFillReplace = vFill[0].replace(vFillSrc, vFillSrcUrl)
38
+ html = html.replace(vFill[0], vFillReplace)
39
+ }
40
+ })
17
41
  }
18
42
 
19
43
  return html
@@ -23,7 +47,7 @@ module.exports = async (html, config = {}, direct = false) => {
23
47
  const url = direct ? config : get(config, 'baseURL')
24
48
  const posthtmlOptions = get(config, 'build.posthtml.options', {})
25
49
 
26
- // `baseUrl` as a string
50
+ // Handle `baseUrl` as a string
27
51
  if (typeof url === 'string' && url.length > 0) {
28
52
  html = rewriteVMLs(html, url)
29
53
 
@@ -34,7 +58,7 @@ module.exports = async (html, config = {}, direct = false) => {
34
58
  .then(result => result.html)
35
59
  }
36
60
 
37
- // `baseUrl: {}`
61
+ // Handle `baseUrl` as an object
38
62
  if (isObject(url) && !isEmpty(url)) {
39
63
  html = rewriteVMLs(html, url.url)
40
64