Skip to content

Simple boilerplate for running MJML for multiple projects

License

Notifications You must be signed in to change notification settings

garmeeh/mjml-multi-project

Repository files navigation

Multi Project Workflow - MJML

This workflow will allow you to keep all of your MJML projects in one place if needed. You can work on projects individually or compile all of the projects at once. There is also a custom watch option so that you work on an individual project. For more info on how the project came about check this blog post

Powered by:

Getting started:

git clone [email protected]:garmeeh/mjml-multi-project.git
yarn install

This will initialize the project with a sample project (cuppas).

To Remove Sample Project & Clean Git run:

yarn clean-up

Running this will remove the sample project and git. You will need to manually remove cuppas from projects.config.js.

Adding a new project

Run:

yarn create-project "newproject"

You will need to add your new project to projects in projects.config.js.

This will create the following folder structure:

├── newproject/                     * new project
 |   ├── common                     * directory to hold partial includes for templates
 |   ├── COMPILED_TEMPLATES         * output folder for this projects templates (.html)
 |   ├── templates                  * mjml template files

Commands available:

$ yarn compile

This will prompt you to pick a project that you would like to compile.

$ yarn compile-all

As the name suggests this will compile all of your projects. This is handy if you are integrating with a CI.

$ yarn watch

This will allow you to work on an individual project and it will auto compile your templates on file change/save.

$ yarn create-project "newproject"

This will scaffold out a new project directory.

$ yarn clean-up

Running this will remove the sample project and git.

Project Structure

mjml-multi-project/
 ├── cuppas/                        * example project
 |   ├── common                     * directory to hold partial includes for templates
 |   ├── COMPILED_TEMPLATES         * output folder for this projects templates (.html)
 |   ├── templates                  * mjml template files
 │
 ├── scripts/
 |   ├── index.js                   *
 |   ├── compile.js                 *
 │   ├── inquirer.js                *
 │   ├── publish.js                 *
 |   ├── watch.js                   *
 │
 ├── tools/                         * helper tools for running the project
 |   ├── logger.js                  * adds a touch of colour to console logs
 |
 ├── .babelrc                       * https://babeljs.io/docs/usage/babelrc/
 ├── .editorconfig                  * http://editorconfig.org/
 ├── .eslintrc                      * https://eslint.org/docs/user-guide/configuring
 ├── .gitignore                     * https://git-scm.com/docs/gitignore
 ├── package.json                   * https://docs.npmjs.com/files/package.json
 ├── projects.config.js             * Configuration file for this project
 └──

TODO

  • Add publish script which will give options of uploading templates to API
  • Add tests for scripts

Contributors

Thanks goes to these wonderful people (emoji key):


Gary Meehan

💬 📝 💻 🎨 📖 💡 🤔 🚇 ⚠️ 🔧

This project follows the all-contributors specification. Contributions of any kind welcome!

About

Simple boilerplate for running MJML for multiple projects

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published