Is your feature request related to a problem? Please describe.
MJML strips self-closing tags of the final forward slash (example: <img /> becomes<img>), both in beautified and non-beautified HTML, and (if I'm not missing something) there's no way to control this.
Describe the solution you'd like
It would be nice to have an option to control this and other behaviors, such as an argument like --config.stripSlashes=false or something along those lines.
It would be super cool to have the option to specify the path of a configuration file, something like a .mjmlrc or mjml-config.json.
Describe alternatives you've considered
Right now the only option is to manually modify the outputted HTML.
Hi,
Is there any issue or need behind that ? Both are basically the same.
On 25 Feb 2019, at 14:15, nevnein notifications@github.com wrote:
Is your feature request related to a problem? Please describe.
MJML strips self-closing tags of the final forward slash (example:becomes
), both in beautified and non-beautified HTML, and (if I'm not missing something) there's no way to control this.
Describe the solution you'd like
It would be nice to have an option to control this and other behaviors, such as an argument like --config.stripSlashes=false or something along those lines.It would be super cool to have the option to specify the path of a configuration file, something like a .mjmlrc or mjml-config.json.
Describe alternatives you've considered
Right now the only option is to manually modify the outputted HTML.—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub, or mute the thread.
Hi,
yes actually, our customer communication management software rejects the output HTML without the forward slash for self-closing tags as invalid.
It looks like it comes from the minifier at some point, as the default code keep the self closing tag : https://mjml.io/try-it-live . It looks like you can override already this behavior with keepClosingSlash to false :
`--config.minifyOptions='{"keepClosingSlash": false}'
I'm sorry but this doesn't work :/
I've done some tinkering with the web app, and I've noticed that even the default code strips the closing slash, but only when there's a <mj-style inline="inline"> (test code here), so it seems that they're stripped in the process that converts the mj-style into inline styles, and not in the beautification/minification processes.
Do you think there's a fast and easy fix?
Is the inlining of styles managed by MJML itself or by an external library?
If this is internal to MJML, would you accept any PR "fixing" this issue?
We're using juice for inlining css stuff with mj style inline. Idk if it's
just an array of option to pass to juice, I think there's already an option
for that, but as it's really specific the default behavior is fine for now
On Mon, Feb 25, 2019 at 5:32 PM nevnein notifications@github.com wrote:
I'm sorry but this doesn't work :/
I've done some tinkering with the web app, and I've noticed that even the
default code strips the closing slash, but only when there's ainline="inline"> (test code here https://mjml.io/try-it-live/r1Wwr5WLV),
so it seems that they're stripped in the process that converts the mj-style
into inline styles, and not in the beautification/minification processes.Do you think there's a fast and easy fix?
Is the inlining of styles managed by MJML itself or by an external library?
If this is internal to MJML, would you accept any PR "fixing" this issue?—
You are receiving this because you modified the open/close state.
Reply to this email directly, view it on GitHub
https://github.com/mjmlio/mjml/issues/1528#issuecomment-467079882, or mute
the thread
https://github.com/notifications/unsubscribe-auth/AAizzZlvKbdDX5pZ4iuIJ0BE4mwkCifiks5vRBAbgaJpZM4bP2Do
.
Hi @nevnein the inlining is handled by the juice library.
Right now the only juice option that we expose is juicePreserveTags you can see an example in the cli documentation (but you can also use this option when using mjml as a node library) https://github.com/mjmlio/mjml/blob/next/packages/mjml-cli/README.md
Maybe it can do the trick
Thank you guys, it was indeed Juice's fault, and juicePreserveTags did solve the issue.
Here's the config I've used, for the sake of completeness and in case anyone stumbles here:
--config.juicePreserveTags='{"imgTag": { "start": "<img", "end": "/>" }, "brTag": { "start": "<br", "end": "/>" }}'
Of course you can add as many self-closing tags as you like, contrary to my initial belief the styles will be inlined anyway, and this works even for img tags generated by mj-image.
Thank you again, keep up the good work ❤️
Most helpful comment
Thank you guys, it was indeed Juice's fault, and
juicePreserveTagsdid solve the issue.Here's the config I've used, for the sake of completeness and in case anyone stumbles here:
--config.juicePreserveTags='{"imgTag": { "start": "<img", "end": "/>" }, "brTag": { "start": "<br", "end": "/>" }}'Of course you can add as many self-closing tags as you like, contrary to my initial belief the styles will be inlined anyway, and this works even for
imgtags generated bymj-image.Thank you again, keep up the good work ❤️