HTML minification parser error
See original GitHub issueDescribe the bug
HTML minification breaks if there is a <
in a <mj-raw>
section.
To Reproduce Steps to reproduce the behavior:
- 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>
- 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
Issue Analytics
- State:
- Created 5 years ago
- Comments:7 (4 by maintainers)
Top Results From Across the Web
Issue #880 · kangax/html-minifier - Parse Error
Hi,. I have a weird issue when I try to minify a template. Module build failed: Error: Parse Error: <>)</p> at new HTMLParser ......
Read more >javascript - html minifier parse error in for loop
It seems you are using a html-minifier on a non-plain html files, with special server tags such as <% and <%=_value%> .
Read more >minify-html - crates.io: Rust Package Registry
minify-html. A Rust HTML minifier meticulously optimised for speed and effectiveness, with bindings for other languages.
Read more >Common Error in Production Mode When html is Minified
Hello everyone, when you set production mode in your Magento 2 and minify the HTML files to speed your website, you often see...
Read more >html-minifier-terser
Highly configurable, well-tested, JavaScript-based HTML minifier.. Latest version: 7.1.0, last published: a month ago.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Maybe @timc13 solution is better then, let’s mention it to the doc instead 🤔
That could be done too but as minify is optional it’s a bit weird to have attribute for a potential option ?