mjmlio / atom-mjml-preview

MJML preview in Atom
https://atom.io/packages/mjml-preview
MIT License
20 stars 4 forks source link

Images not being displayed #8

Closed pidjey13 closed 6 years ago

pidjey13 commented 7 years ago

First of all sorry for any mistake about the language and about posting this issue, 'cause It's the first time I open an issue.

The problem is that in the live preview on Atom images in the solution (so it's not about images hosted on the internet) are not being displayed.

It's the first project I do using MJML, so I don't know if I'm the only one, but I thought to open that issue if it can be helpful somehow.

ngarnier commented 7 years ago

Hey @pidjey13, sorry for the late answer. You can serve local images by using the absolute path to the image.

The preview is rendering and writing the HTML file in a temp folder so the path of the HTML file and the path of the images don't match. I don't see any "easy" way to support relative paths for images other than actually writing the file in the same folder... what do you think @iRyusa?

iRyusa commented 7 years ago

We could rewrite every src to absolute path with a regexp but don't know if it will work

ngarnier commented 7 years ago

Or something similar to what @meriadec did in the app: https://github.com/mjmlio/mjml-app/blob/master/app/components/Iframe/index.js#L58-L64

iRyusa commented 7 years ago

Don't know how the app work internally but we're using a tempfile in the atom editor, I don't know if we can alter the view as @meriadec does