Giter VIP home page Giter VIP logo

mjml-mailchimp's Introduction

MJML Mailchimp

Mailchimp compatible MJML components.

Usage

Custom components require a programmatic pipeline to turn mjml into html.

Notice that custom components begin mc- and not mj-

// convert-mjml-to-html.js

const mjml2html = require('mjml');
const { registerComponent } = require('mjml-core');
const { registerDependencies } = require('mjml-validator');
const { McSection, McImage } = require('mjml-mailchimp');

registerComponent(McSection);
registerComponent(McImage);
registerDependencies({
  'mc-section': ['mj-column', 'mj-group', 'mj-raw'],
  'mj-column': ['mc-image'],
  'mj-hero': ['mc-image'],
});

const template = `
<mjml>
  <!-- // -->
  <mc-section mc:repeatable="sections" mc:variant="Large Image">
    <mj-column>
      <mc-image mc:edit="Image 01" src="http://placehold.it/600x400">
    </mj-column>
  </mc-section>
  <!-- // -->
</mjml>
`;

// Alternatively read from the file system eg.:
// const template = fs.readFileSync(process.argv[2]);

console.log(mjml2html(template));
# Run custom pipeline
$ node convert-mjml-to-html.js

# or read from filesystem
$ node convert-mjml-to-html.js template.mjml

mjml-mailchimp's People

Contributors

ambroisemaupate avatar bastienrobert avatar homerjam avatar roelvanhintum avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

mjml-mailchimp's Issues

Use with gulp

Hi here is it possible to use with gulp and npm? sorry i tried this and im not abre to run nothing i liek to use mailchimp atributes in mjml this is the only package availabre but don´t seem to work? can you provite more documentation? how is supose to build my mjml?

More details for getting started - step by step?

Is there a step-by-step guide for setting up a project locally? How does it work? Are there any working examples? I'm not that experienced with node.js. I know how to set it up but I don't really understand that much yet, so the readme doesn't really help me... Some more context would be very helpful!

Trouble getting started with this component

Hey all,
Having trouble figuring out how to get started with this component. I am in need of a bit of guidance on how exactly to get this up and running.

I have been cloning the project, then running yarn, yarn build then attempting to run a test.js file containing the example code through node but I am just receiving errors.

Can someone please provide me with a little guidance on how to get going.

Thanks.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.