mjmlio / mjml

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

Output multiple files, preserving folder structure #2502

Open mosesoak opened 2 years ago

mosesoak commented 2 years ago

Is your feature request related to a problem? Please describe.

Would like build and develop to easily output multiple files when using glob path for the input. Currently, as reported in https://github.com/mjmlio/mjml/issues/1014, just a single file is outputted. (Based on my testing, I don't believe that issue was ever actually resolved.)

When building a batch of emails you want to be able to move between them during development and then publish the whole batch when complete.

Describe the solution you'd like

It would be cool if mjml would publish a matching directory structure based on the glob input. Something like this:

mjml -w src/**/index.mjml -o public/

// input folders
src
  mail001
    index.mjml
    partial.mjml
  mail002
    index.mjml
    partial1.mjml
    partial2.mjml

// output
public
  mail001
    index.html
  mail002
    index.html

Currently, not even the -o folder gets created (e.g. public), and mjml errors if it doesn't exist. With this feature, the output directory and all matching subdirectories found for each index.mjml file would be automatically created.

Describe alternatives you've considered

We're currently writing our own scripts to run multiple builds. I can potentially look into running nodemon as a development workaround as mentioned in https://github.com/mjmlio/mjml/issues/755.

iRyusa commented 2 years ago

It might not be as hard as it seems but I don't have time to properly test this.

probablyabear commented 2 years ago

@mosesoak I have a solution that uses gulp/nodemon to do what you're talking about. LMK if you'd like an example repo.

mosesoak commented 2 years ago

@probablyabear Sure if you have time to link to a public repo that sounds helpful. We typically don't use Gulp but then again our email workflow has bash scripts and a bunch of rando tools so why not! Thanks