Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bad path in mj-include does not make a validation error #1689

Closed
mikob opened this issue Aug 26, 2019 · 4 comments
Closed

Bad path in mj-include does not make a validation error #1689

mikob opened this issue Aug 26, 2019 · 4 comments

Comments

@mikob
Copy link

mikob commented Aug 26, 2019

Describe the bug
If you use mj-include, when you call eg.

    const mostlyRenderedHTML = mjml2html(mjmlTemplate);

you might get errors with not being able to find the includes as comments in the html, but they should be validation errors IMO as they represent a serious ommission with the rendered html.

To Reproduce
Have mj-includes in a subdirectory.

Expected behavior
mostlyRenderedHTML.errors should not be [], or strict validation should throw an error.

MJML environment (please complete the following information):

  • OS: Linux
  • MJML Version 4.2
  • MJML tool used node package
@iRyusa
Copy link
Member

iRyusa commented Aug 26, 2019

I really like this idea cc @kmcb777

@kmcb777
Copy link
Collaborator

kmcb777 commented Aug 27, 2019

Yes it would be quite logical indeed.
The only problem is that mj-includes are completely handled by the parser, and the parser only returns the JSON mjml, we'll have to modify the structure of the parser's output to be able to handle this.
This would break projects that use the parser directly, like passport :/

@iRyusa
Copy link
Member

iRyusa commented Aug 27, 2019

Mhhh right, but when parsing it, we replace non valid include by an mj-raw comment. Can we just maybe add an extra "hidden" params to this node and just read it on mjml-validator ?

@kmcb777
Copy link
Collaborator

kmcb777 commented Aug 27, 2019

Yup good idea 👍
Right now i think mj-raws are ignored by the validator, but this shouldn't be a real problem

kmcb777 added a commit that referenced this issue Sep 12, 2019
fix #1689 add warning when included file not found
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants