SparkPost / heml

HEML is an open source markup language for building responsive email.
https://heml.io
MIT License
4.33k stars 157 forks source link

Base tag not working with images #13

Closed nhemenway closed 6 years ago

nhemenway commented 6 years ago

When attempting to use the base element along with an img, I'm getting the following error:

(node:1612) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): TypeError: Expected a string

I get this error whether or not my img src is relative or absolute.

Example:

<heml>
  <head>
    <base href="http://via.placeholder.com" />
  </head>
  <body>
    <img src="/350x150" alt="my image" infer />
  </body>
</heml>
avigoldman commented 6 years ago

Oh good catch. Looks like there are a couple of bugs in this case.

  1. base gets applied after the render so infer won't properly get applied
  2. base is searching for both elements with href and src but only applying the base to the href attribute.

PR with the fix coming shortly!

avigoldman commented 6 years ago

I'd love to get your eyes on PR #16

For context:

nhemenway commented 6 years ago

Makes sense. Thanks!