![]() It is intentionally basic as the idea is to show you how to create your own component specific to your need. We’ll create a simple component that display a 2 column layout with an image on the left part and a text on the right part. ![]() If you don’t want to automatically watch and recompile the files, you can simply run npm run build to compile them manually whenever you want. Run npm start so that index.mjml and your custom components are recompiled at each edit you’ll make. To get the local path from your terminal, run pwd ( echo %cd% on Windows). mjmlconfig in your terminal and replace the path to /lib/MjColumnImageText.js to your local path to this file. The file will probably be hidden by default when you browse the folder. mjmlconfig file where you are registering your custom components so they can be used by the MJML engine which wouldn’t know them otherwise.įirst, it is important that you change the path to your component in. You should not edit the files in this folder. A lib folder, where custom components compiled from ES6 to ES5 with babel are located.A components folder, where your custom components written in ES6 are located.This is where your MJML lives and where we will use the custom component (uncomment it to use it!). The most important elements of this boilerplate are: While you’re installing dependencies, let’s go over what is in this folder. Then, run npm install to install the dependencies. To do so, just open your terminal (go to wherever you want your folder to be created) and run git clone & cd mjml-component-boilerplate. Don’t worry though, we got you covered with a boilerplate so all you have to do is clone the component boilerplate. ![]() Since MJML is written in ES6, it is dependant on a few things like Babel. Let’s walk you through the component creation process. Added to the standard library of components, it is possible for anyone to create their own component, leveraging MJML’s easy syntax to make it easier to reuse bits of code without having to type them over and over. MJML is built upon components, used under the form of tags in the markup language. Tutorial: creating your own MJML component ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |