mjmlio / mjml

MJML: the only framework that makes responsive-email easy
https://mjml.io
MIT License
17.08k stars 960 forks source link

mjml4: mj-attributes cannot read property reduce of undefined #921

Closed vielhuber closed 6 years ago

vielhuber commented 6 years ago

Simple example:

<mjml>
    <mj-head>
        <mj-attributes>
            <mj-class name="small" font-size="10px" line-height="14px" />
        </mj-attributes>
    </mj-head>
    <mj-body>
    </mj-body>
</mjml>

throws an error because of mj-class:

File: index.mjml
TypeError: Cannot read property 'reduce' of undefined
Input file(s) failed to render
kmcb777 commented 6 years ago

Thanks for reporting this issue. Actually this is caused by a new feature : now you'll be able to nest mj-elements inside mj-class declaration, i.e.

<mj-attributes>
    <mj-class name="small" font-size="10px" line-height="14px">
      <mj-text font-size="22px" />
    </mj-class>
</mj-attributes>

This will give every mj-text inside a mj-element with mj-class="small" a font-size of 22px.

We will fix this situation, for now as a hotfix you can just add some child in your mj-class and you won't get this error.