stidges / laravel-mix-mjml

Laravel Mix plugin to compile MJML files

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

MJML includes not working

1stevengrant opened this issue · comments

Finding that <mj-include path="./components/header" /> as per https://mjml.io/documentation/#mj-include don't seem to work.

The Laravel Mix task tries to build the individual MJML components into their own Blade files (which makes sense).

Hi, think you have to add absolute path not relative (based app base_path).

<mj-include path="resources/mail/components/header" />

@1stevengrant Can you show me the mix config file you are using to call the plugin? It should only pickup the files you explicitly specify in your config, the actual rendering is handled by mjml itself.

@vanderb Thanks for the tip! I just found that mjml supports a filePath option, would it make sense to make all paths relative to the current file being rendered?

I'm having this issue as well. @stidges this should solve it if we can specify a base path to use. Thanks!

I'll see if I can get something going this week! I found the issue inside the plugin, fixing them would introduce some breaking changes though.

I just published v2.0.0 for this plugin! Includes should now be working as expected using relative paths, and globs can now be used for the input path to prevent partials from being compiled as well. You can view the release notes here