How to use the mjml function in mjml

To help you get started, we’ve selected a few mjml examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github image-charts / mjml-chart / test / mjml-chart.spec.js View on Github external
it('should render a mjml chart', () => {
      expect(
        mjml2html(`
          
            
              
            
          `).html
      ).to.contain(
        ''
      );
    });
github jimmyleray / Emendare / server / src / emails / templates / activation / activation.ts View on Github external
html: (activationToken: string) =>
    mjml2html(`
    
    
      ${header}
      
        
          Activation du compte
          Cliquez sur le lien ci-dessous pour activer votre compte sur Emendare:
          Activer mon compte
          L'équipe d'Emendare
        
      
      ${footer}
    
github kaliberjs / build / example / src / mjml-renderer.js View on Github external
export default function mjmlRenderer(template) {
  const { html, errors } = mjml2html(htmlReactRenderer(template))

  if (errors.length > 0) throw new Error(errors.map(e => e.formattedMessage).join('\n'))

  return html
}
github mjmlio / atom-mjml-preview / lib / mjml-view.js View on Github external
renderMJML(TextEditor, done) {
    const mjmlTempPath = path.resolve(path.join(os.tmpdir(), `${TextEditor.getTitle()}.html`))
    const outputHTML = mjml2html(TextEditor.getText(), { level: 'skip', disableMinify: true, filePath: TextEditor.getPath() }).html

    fs.writeFile(mjmlTempPath, outputHTML, (err) => {
      if (err) {
        throw err
      }

      done(mjmlTempPath)
    })
  }
github lskjs / lskjs / packages / lsk-modules / packages / mailer / src / templates / _mjml.js View on Github external
getHtml() {
    const { errors, html } = mjml2html(this.render());
    if (__DEV__) {
      if (errors && errors.length) {
        this.log.error('Template.getHtml mjml', errors);
      }
    }
    return html;
  }
github wix-incubator / mjml-react / src / index.js View on Github external
function render(email, options = {}) {
  const defaults = {
    keepComments: false,
    beautify: false,
    minify: true,
    validationLevel: 'strict'
  };
  return mjml2html(renderToMjml(email), {...defaults, ...options});
}
github attilabuti / vscode-mjml / src / helper.ts View on Github external
export function mjmlToHtml(
    mjml: string, minify: boolean, beautify: boolean, path?: string, validation: "strict" | "soft" | "skip" = "skip"
): { html: string, errors: any[] } {
    try {
        if (!path) {
            path = getPath();
        }

        return mjml2html(mjml, {
            beautify,
            filePath: path,
            minify,
            mjmlConfigPath: getCWD(path),
            validationLevel: validation
        });
    } catch (error) {
        return { html: "", errors: [error] };
    }
}
github artsmia / lume / data-api / graphql / resolvers / editUserOrganizationRole.js View on Github external
function pendingEmail({ user, org }) {
  return mjml2html(`
    
      
        
          
            

              Your request to join ${org.name} has been approved.

              Head over to <a href="https://lume.space/cms/${
                org.subdomain
              }">your organization's home</a> to start working on a story now!

            
          
        

mjml

MJML: the only framework that makes responsive-email easy

MIT
Latest version published 10 months ago

Package Health Score

85 / 100
Full package analysis