Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

eleventy-plugin-mjml

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

eleventy-plugin-mjml

Create HTML email with Eleventy and MJML

  • 1.0.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

eleventy-plugin-mjml

Generate HTML email content with Eleventy and MJML.

What this does

This allows you to add .mjml template files to your Eleventy input directory, which are then converted to HTML during your Eleventy build.

I'm working out how you could build your HTML emails within your Eleventy site, and then send them using an email API like Mailjet.

Installation

Install package

npm install eleventy-plugin-mjml

Add to .eleventy.js

const { MjmlPlugin } = require("eleventy-plugin-mjml");

module.exports = function (eleventyConfig) {
  eleventyConfig.addPlugin(MjmlPlugin, {
    // if you want to use Nunjucks syntax within your MJML files, set to true
    preprocessWithNunjucks: false,

    // You can add Nunjucks filters here
    // the key is the name of the filter, and the value is the function
    nunjucksFilters: {
      myImaginaryFilter: (value, param) => value,
    },
  });
};

Add an .mjml file to your input directory

Eg. src/index.mjml

<mjml>
  <mj-body>
    <mj-section>
      <mj-column>
        <mj-text> {{title}}! </mj-text>
      </mj-column>
    </mj-section>
  </mj-body>
</mjml>

If you enable the preprocessWithNunjucks option, you can use Nunjucks within the .mjml files:

---
title: My Newsletter
---

<mjml>
  <mj-body>
    <mj-section>
      <mj-column>
        <mj-text>{{title}}</mj-text>
      </mj-column>
    </mj-section>
  </mj-body>
</mjml>

Keywords

FAQs

Package last updated on 05 Apr 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc