Skip to content

HTML minification parser error #1527

@timc13

Description

@timc13

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions