mjmlio / gulp-mjml

Add Gulp to your MJML workflow!
MIT License
162 stars 37 forks source link

Using gulp-mjml and a custom render engine produces CDATA wrapped text #9

Closed leemiller closed 7 years ago

leemiller commented 7 years ago

Using gulp-mjml v1.0.1 and mjml 2.3.3 wraps all of the text in tags in CDATA tags twice, but only the outer of those tags is removed after rendering.

The code

[_mjmlButton2.default, _mjmlColumn2.default, _mjmlContainer2.default, _mjmlDivider2.default, _mjmlGroup2.default, Hero, HeroContent, _mjmlHtml2.default, _mjmlImage2.default, InlineLinks, Invoice, InvoiceItem, Link, _mjmlList2.default, _mjmlLocation2.default, Navbar, _mjmlRaw2.default, _mjmlSection2.default, _mjmlSocial2.default, _mjmlSpacer2.default, _mjmlTable2.default, _mjmlText2.default].map(_mjmlCore.registerMJElement);

is run twice; once for the default mjml engine in gulp-mjml, and once for my custom engine. This causes the rendering engine of either instance to loop over each of those types of components twice, wrapping the inner contents in two CDATA tags.

I have an example here.

meriadec commented 7 years ago

Hi, this will be fixed in the next mjml version (see https://github.com/mjmlio/mjml/pull/392). You can edit the node_modules/mjml-core/lib/MJMLElementsCollection.js file as a temporary fix.

leemiller commented 7 years ago

Thank you @meriadec !