mjml-to-react-email

Migrate MJML email templates to React Email templates

Example

steps:
  - tools:
      - name: find_files_by_name_with_regex
        arguments:
          find_file_name_pattern: '.mjml$'
        returns: files
      - name: async_each
        items: '{{ files }}'
        each_item:
          item_name: file
          tools:
            - name: run_terminal_command
              arguments:
                command: 'npx mjml {{ file }} -o {{ file }}.html'
            - name: edit_file
              arguments:
                path_to_file: '{{ file }}.html'
                edit_prompt: |
                  "Develop a {{ file }}Template.jsx React email template with the 'react-email' module (https://www.npmjs.com/package/react-email) to match this HTML structure: 
                  Only use these '@react-email/components' components: Button, Column, Container, Font, Head, Heading, Hr, Html, Image, Link, Markdown, Preview, Section, Tailwind, Text.
                  Do not use 'react-html-email', or 'email-templates', or 'react-email-components'."
              returns: '{{ file }}.html'
            - name: change_file_extension
              arguments:
                path_to_file: '{{ file }}.html'
                new_extension: '.jsx'
              returns: '{{ file }}.jsx'
  - tools:
      - name: find_files
        arguments:
          find_files_prompt: 'Find package.json'
        returns: files
      - name: run_terminal_command
        arguments:
          command: 'npm install react-email'
      - name: async_each
        items: '{{ files }}'
        each_item:
          item_name: file
          tools:
            - name: edit_file
              arguments:
                path_to_file: '{{ file }}'
                edit_prompt: 'Remove mjml packages. Make no other changes.'
                modify_with_diff: true
              returns: '{{ file }}'

Last updated