This is a little template builder for Hubspot using MJML. Really simple to use. I hope. Let's get started.
- Clone Repo
- Run
npm install
- Run
npx hs init
to create ahubspot.config.yml
- Start building!
- Run
npm run email
- This will watch
_src/email_markup/
- Any changes to
_src/email_markup/module_markup/
will trigger the processing of markup in mjml and convert them into module.html files in corresponding directories in_dist/
. If a module has yet to be created, the script will build the necessary module files first. - Similarly, any changes to
_src/email_markup/static_markup
will trigger the process and convert them intofilename.html
files in `_dist/email_static'. - Any chances to
_src/required_markup
will trigger a build to all - Use the proper
{{ module.your_field }}
in your MJML files and configure the fields in the modules in the_dist/email_modules/your.module/fields.json
- You can then create regular hubspot .html templates in
_dist/email_templates/
using HUBL and configure the npm scripts to upload to your portal if you like
- Make sure your MJML module and static markup includes
<mjml>
<mj-include path="../required_markup/head.mjml" />
<mj-body>
<!-- begin module -->
at the top and
<!-- end module -->
</mj-body>
</mjml>
at the bottom. This is how MJML pulls in any styling and adds it inline in your html markup before.
- Wanna get fancy with MJML? Check out their super simple documentation: Check it out
- Have a question? Have suggestion? Are my instructions terrible? Submit a pull request or contact me: douglaswelcome@gmail.com