-
Notifications
You must be signed in to change notification settings - Fork 965
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
HTML minification parser error #1527
Comments
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 ***@***.***> wrote:
*Describe the bug*
HTML minification breaks if there is a < in a <mj-raw> section.
*To Reproduce*
Steps to reproduce the behavior:
1. Create a file with this MJML code:
<mjml>
<mj-body>
<mj-section>
<mj-column>
<mj-raw>
{% if foo < 5 %}
{% endif %}
</mj-raw>
<mj-text>Hello World</mj-text>
</mj-column>
</mj-section>
</mj-body>
</mjml>
1. compile using the API:
const output = mjml2html(file.contents.toString(), {
minify: true,
filePath: file.path,
})
1. 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
<#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 |
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 |
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
|
That could be done too but as minify is optional it's a bit weird to have attribute for a potential option ? |
fix #1527 doc to ignore content during minification
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):
The text was updated successfully, but these errors were encountered: