mjmlio / mjml

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

Mjml If condition is not working #2611

Closed Daniel-wethenew closed 1 year ago

Daniel-wethenew commented 1 year ago

Describe the bug Hello there, conditional statement just doest not work or I'm really missing something. I've spent the afternoon trying to figure it out

Additional context this issue https://github.com/mjmlio/mjml/issues/1265 have been closed and I dont know why because the given doesn't even work on the online editor. here is the link given has a solution https://mjml.io/try-it-live/rkiGUi_GX you can try changing the condition as you want the block is still rendering...

iRyusa commented 1 year ago

Mjml simply doesn’t have any templating language built in that’s why

Daniel-wethenew commented 1 year ago

Mjml simply doesn’t have any templating language built in that’s why

thank you for the quick reply ! The answer given in the issue linked is missleading... for those using mandrill the answer you looking for is right here https://support.iterable.com/hc/en-us/articles/205480365#if-statements-if for my case it will look like this

<mj-raw>{{#unless someBooleanVariable}}</mj-raw>
    <mj-section>
      <mj-column>
        <mj-text>{{data}}</mj-text>
      </mj-column>
    </mj-section>
<mj-raw>{{/unless}}</mj-raw>