Closed timc13 closed 5 years ago
I don't think we'll be able to do something about this as we use an external lib to provide the minification :/ maybe wrap everything into html comment ?
On Thu, Feb 21, 2019 at 5:40 PM Tim Chen notifications@github.com wrote:
Describe the bug HTML minification breaks if there is a < in a
section. To Reproduce Steps to reproduce the behavior:
- Create a file with this MJML code:
{% if foo < 5 %} {% endif %} Hello World
- compile using the API:
const output = mjml2html(file.contents.toString(), { minify: true, filePath: file.path, })
- See error:
Error: Parse Error: < 5 %}
Expected behavior Expected minified HTML to succeed
MJML environment (please complete the following information):
- OS: MacOS 10.14.3
- MJML API Version 4.3.1
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/mjmlio/mjml/issues/1527, or mute the thread https://github.com/notifications/unsubscribe-auth/AAizzUxMA5PXbORsYCqyxtiWzrHEET14ks5vPsv-gaJpZM4bH2rS .
-- Cordialement, Maxime BRAZEILLES
found an answer: https://github.com/kangax/html-minifier#ignoring-chunks-of-markup. might be worth mentioning in the documentation of mj-raw
Maybe it would be great to add those automatically when using mj-raw + minify option cc @kmcb777
@iRyusa I tested using this html-minifier feature and it works well It would be much cleaner to apply this on all endingTags instead of just mj-raw, so that we can handle this on the parser. On the other hand, it will prevent minification of all the endingTags content. People often use html in those, and will probably want to have it minified, so maybe we should add an option ?
Maybe @timc13 solution is better then, let's mention it to the doc instead 🤔
what about this idea:
add an attribute to mj-raw instructing the parser to inject the htmlmin:ignore
tag.
<mj-raw ignore-min>
</mj-raw>
That could be done too but as minify is optional it's a bit weird to have attribute for a potential option ?
Describe the bug HTML minification breaks if there is a
<
in a<mj-raw>
section.To Reproduce Steps to reproduce the behavior:
Expected behavior Expected minified HTML to succeed
MJML environment (please complete the following information):