Closed drush closed 1 year ago
Just wrap them in comment or mj raw and you should be fine On 20 Jan 2023, at 19:15, Darren Rush @.***> wrote: MJML with ERB tags can be processed, but ERB tags break the validator, leaving a developer with unnecessary warnings/errors, and breaking preview functionality in the native tool, or plugins such as the VSCode extension.
There are a few options here:
Native ERB support - just skip everything inside of <% %> tags Enable a comment-pragma such as to explicitly allow different tags on a file-by-file basis
I recognize that ERB is not the only game in town, and I'd expect this feature to support other popular templating syntaxes, but ERB is a very popular one and has an ecosystem of support tools include mlml, mdml-rails, etc.
—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you are subscribed to this thread.Message ID: @.***>
Thanks Maxime. mj-raw
does fix the issue in preview, but if the yielded content is MJML, it doesn't get processed when it is combined with layout.
If you output mjml in your block then there’s nothing we can do about this. As MJML will parse this as content there’s no way for us to prevent that.On 20 Jan 2023, at 19:41, Darren Rush @.***> wrote: Thanks Maxime. mj-raw does fix the issue in preview, but if the yielded content is MJML, it doesn't get processed when it is combined with layout.
—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you commented.Message ID: @.***>
To be clear, there is no expectation that MJML will process the yield
at all, this is handled by the layout system which will composite the file in the app before passing it to MJML.
At edit time, this file should process and ignore the yield.
In dev or production, mjml-rails combines the layout and the yield content, THEN passes it to MJML, which also works.
This is about breaking the preview as part of the DX.
If we start this our linter need to be aware of every templating language and it's likely that we'll have false positive at some point resulting to some valid message being filtered.
We're aware about how degraded it is when used in addition of a templating language but there's not so much we can do as the parser isn't our project and we only can do something on the linting side and as said before it's very likely to add more issue than it solve.
MJML with ERB tags can be processed, but ERB tags break the validator, leaving a developer with unnecessary warnings/errors, and breaking preview functionality in the native tool, or plugins such as the VSCode extension.
There are a few options here:
<% %>
tags<!-- mjml-allow SOMETHING -->
to explicitly allow different tags on a file-by-file basismj-raw
fixes the issue in preview, but doesn't allow 'yielded' content in this case to be additional MJML tags, which is desired. ie<mj-allow><%= yield %></mj-allow>
I recognize that ERB is not the only game in town, and I'd expect this feature to support other popular templating syntaxes, but ERB is a very popular one and has an ecosystem of support tools include mlml, mdml-rails, etc.