gulp-email-builder icon indicating copy to clipboard operation
gulp-email-builder copied to clipboard

EmailBuilder possibly getting wrong `relativePath` value

Open JadeMatrix opened this issue 7 years ago • 1 comments

On emailBuilder.js line 70 options.relativePath is set to the buffer's base, which the Gulp docs say is

Used for relative pathing. Typically where a glob starts.

This means EmailBuilder will end up trying to load CSS relative to the base path of the glob rather than each HTML file. So for example, if you glob for src/**/*.html and if one of those HTML files — say src/foo/bar.html — links to ../foo.css, Gulp will try to load src/../foo.css rather than src/foo/../foo.css. Replacing file.base with path.dirname(file.path) on at least line 70 (and possibly also line 38) results in the second behavior — relative CSS links are relative to the HTML file. Currently, the same set of CSS & HTML files can be processed with one glob but fail with another; making this change would give more predicable behavior.

JadeMatrix avatar Feb 22 '17 19:02 JadeMatrix

Pretty sure I'm running into this issue as well. If I glob ./Templates/Emails/src/**/*.htm I get "Not found, skipping" messages and the css is not embeded. But if I use ./Templates/Emails/src/NameOfFolder/*.htm it works fine

pleek91 avatar Jul 15 '19 21:07 pleek91