Skip to content

mj-style-inline implementation#11

Open
caluwaertp wants to merge 1 commit into
digitalfondue:mainfrom
caluwaertp:mj-style-inline
Open

mj-style-inline implementation#11
caluwaertp wants to merge 1 commit into
digitalfondue:mainfrom
caluwaertp:mj-style-inline

Conversation

@caluwaertp

Copy link
Copy Markdown
Contributor

This PR adds support for the inline attribute of the mj-style tag. To achieve this a css-selector was needed, so I based most of the code to to that on the jericho-selector project.

@syjer

syjer commented May 8, 2025

Copy link
Copy Markdown
Member

First of all, thank you for dedicating your time for this feature.

I was planning to add the css selector support with a custom implementation, directly in the html parser (jfiveparse), as I think it would be the more correct place for it.

As it is, I don't think I'll merge the PR right now, I'll ask you to wait a little bit longer, so you can integrate your changes when I release the updated html5 parser with css selector support.

I guess you have given me a good reason to do the css selector support right now :P.

Btw, I've noticed that most of the added classes are public, I would prefer if the exposed API to the end user would be way more limited -> I prefer package visibility if possible (see https://javadoc.io/doc/ch.digitalfondue.mjml4j/mjml4j/latest/ch.digitalfondue.mjml4j/ch/digitalfondue/mjml4j/package-summary.html , there is basically nothing exposed :))

@caluwaertp

Copy link
Copy Markdown
Contributor Author

Indeed it makes more sense to add it to JFiveParse like JSoup does. It was more of a challenge for me to see if I could pull it off. But the css inline support would be more than welcome though.

@syjer

syjer commented May 8, 2025

Copy link
Copy Markdown
Member

css inline support would be more than welcome though.

Btw, as I never used this feature, is there a specific use case which the non inline version does not work?

@caluwaertp

Copy link
Copy Markdown
Contributor Author

I once needed it in the past with a complicated mail layout using many tables in tables. But nowadays clients are getting better and better, and maybe it's becoming obsolete. But still the html generated by mjml also contains a lot of inline css.
Many websites still recommend using inline css styles for creating html mail templates.

@syjer

syjer commented May 8, 2025

Copy link
Copy Markdown
Member

good to know. Implementing the css-selector will also unlock mj-html-attributes, so I guess it's worth a try :)

@syjer syjer mentioned this pull request May 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants