Mjml: Aren't mj-wrapper infinitely nestable?

Created on 13 Jun 2017  路  4Comments  路  Source: mjmlio/mjml

Hi, I'm using wrappers inside other wrappers to organize my code and get shared backgrounds on elements. It's very useful and works fine on the mjml-app preview. Are there any known side-effects of doing this when rendering on different clients?

image

Most helpful comment

I think it could be useful :(

All 4 comments

Hi @lucasnantonio
Can you share some kind of screenshot where wrapper nesting is useful ? Multiple nesting adds complexity and more HTML to the output so you should use it wisely. It's the same thing as nesting section within a column for some people it works, but we're not recommend it

Hi @iRyusa, here's what I'm using it for:

I have an container, an outer wrapper (n潞1) with a box-shadow style, and inside it I have some sections wrapped in a gray bg wrapper(n潞2).

This way i can declare the gray bg only once for the wrapper, as well as the border-top and border-bottom lines. Otherwise I'd have to declare these properties in each of the sections.

slice

I think this could be way easier with a mj-class for your middle sections. Wrapper would add some non needed overhead that could potentially break something.

I'd agree that it looks useful for border, but this look like an really edgy case to support something like that.

If there's some community interest in this we might take a look at it, but for now I think I can close this one

I think it could be useful :(

Was this page helpful?
0 / 5 - 0 ratings