question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

HTML minification parser error

See original GitHub issue

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

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:7 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
iRyusacommented, Mar 26, 2019

Maybe @timc13 solution is better then, let’s mention it to the doc instead 🤔

0reactions
iRyusacommented, Mar 26, 2019

That could be done too but as minify is optional it’s a bit weird to have attribute for a potential option ?

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found