All Projects β†’ ramasilveyra β†’ mjml-loader

ramasilveyra / mjml-loader

Licence: MIT license
MJML loader for webpack

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to mjml-loader

react-spa-template
This is a sample template for single page applications built using React + Router to work with webpack dev server
Stars: ✭ 19 (-29.63%)
Mutual labels:  webpack-loader
color-loader
🎨 A webpack loader that extracts the color palette of an image
Stars: ✭ 14 (-48.15%)
Mutual labels:  webpack-loader
mjml-rest-client
Java library to convert MJML templates to HTML
Stars: ✭ 16 (-40.74%)
Mutual labels:  mjml
plugin-grapesjs-builder
GrapesJS HTML and MJML integration for Mautic
Stars: ✭ 42 (+55.56%)
Mutual labels:  mjml
svelte-loader-hot
Webpack loader for svelte components with HMR support
Stars: ✭ 22 (-18.52%)
Mutual labels:  webpack-loader
webpack-modernizr-loader
Get your modernizr build bundled with webpack, use modernizr with webpack easily
Stars: ✭ 35 (+29.63%)
Mutual labels:  webpack-loader
lodash-loader
Cherry-picks Lodash functions and require them explicitly to reduce the webpack bundle size.
Stars: ✭ 13 (-51.85%)
Mutual labels:  webpack-loader
React-bookstore
Bookstore using google-book Apis made with reactjsπŸ”₯πŸš€
Stars: ✭ 14 (-48.15%)
Mutual labels:  webpack-loader
markup-inline-loader
a webpack loader to embed svg/MathML to html
Stars: ✭ 24 (-11.11%)
Mutual labels:  webpack-loader
graphql-raw-loader
πŸ– With Webpack, loads GraphQL files as raw strings and handle it's import directive & comment statement.
Stars: ✭ 19 (-29.63%)
Mutual labels:  webpack-loader
virtual-dependency-loader
webpack loader that takes a single file, and declare pieces of that file as "dependencies" as if it existed.
Stars: ✭ 33 (+22.22%)
Mutual labels:  webpack-loader
angular-translate-loader
"angular-translate" loader for webpack
Stars: ✭ 15 (-44.44%)
Mutual labels:  webpack-loader
tde-webpack-mjml-plugin
Webpack plugin for converting MJML files to HTML
Stars: ✭ 12 (-55.56%)
Mutual labels:  mjml
zahper
Zahper - The power of MJML into Laravel newsletters
Stars: ✭ 13 (-51.85%)
Mutual labels:  mjml
graphql-loader
πŸ’ A webpack loader for .graphql documents
Stars: ✭ 60 (+122.22%)
Mutual labels:  webpack-loader
webpack-webmanifest-loader
Minimalistic webpack loader to generate webmanifest file (and process icons URLs).
Stars: ✭ 16 (-40.74%)
Mutual labels:  webpack-loader
mjml-bundle
βœ‰οΈ Symfony bundle for MJML
Stars: ✭ 87 (+222.22%)
Mutual labels:  mjml
vue-template-compiler-loader
Webpack loader to pre-compile Vue 2.0 templates
Stars: ✭ 26 (-3.7%)
Mutual labels:  webpack-loader
nunjucks-loader
Webpack loader for Nunjucks templates
Stars: ✭ 20 (-25.93%)
Mutual labels:  webpack-loader
preprocessor-loader
Bring the awesome "Conditional Compilation" to the Webpack, and more.
Stars: ✭ 32 (+18.52%)
Mutual labels:  webpack-loader

MJML loader for webpack

Converts MJML files to HTML and exports them as string.

Table of Contents

Install

Node.js v6.5 or newer is required.

webpack 2 or newer is required.

Via the yarn client:

$ yarn add --dev mjml-loader webpack

Via the npm client:

$ npm install --save-dev mjml-loader webpack

Usage

Look into the official webpack loaders usage documentation.

At this moment this loader has no options.

Examples

Compile MJML file to HTML file

For transforming a MJML file to a HTML file is better to use mjml cli or gulp-mjml.

Inline the MJML result (HTML) into bundle

With this configuration:

{
  // ...
  module: {
    rules: [
      { test: /\.mjml$/, loader: 'mjml-loader' }
    ]
  }
  // ...
}

With this MJML file:

template.mjml

 <mjml>
  <mj-body>
    <mj-container>
      <mj-section>
        <mj-column>
          <mj-text>Hello World!</mj-text>
        </mj-column>
      </mj-section>
    </mj-container>
  </mj-body>
</mjml>

This entry point:

index.js

import template from './template.mjml';
console.log(template);

The console output will be:

<!doctype html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title></title>
<style type="text/css">
  #outlook a { padding: 0; }
  .ReadMsgBody { width: 100%; }
  .ExternalClass { width: 100%; }
  .ExternalClass * { line-height:100%; }
  body { margin: 0; padding: 0; -webkit-text-size-adjust: 100%; -ms-text-size-adjust: 100%; }
  table, td { border-collapse:collapse; mso-table-lspace: 0pt; mso-table-rspace: 0pt; }
  img { border: 0; height: auto; line-height: 100%; outline: none; text-decoration: none; -ms-interpolation-mode: bicubic; }
  p { display: block; margin: 13px 0; }
</style>
<!--[if !mso]><!-->
<style type="text/css">
  @import url(https://fonts.googleapis.com/css?family=Ubuntu:300,400,500,700);
</style>
<style type="text/css">
  @media only screen and (max-width:480px) {
    @-ms-viewport { width:320px; }
    @viewport { width:320px; }
  }
</style>
<link href="https://fonts.googleapis.com/css?family=Ubuntu:300,400,500,700" rel="stylesheet" type="text/css">
<!--<![endif]-->
<style type="text/css">
  @media only screen and (min-width:480px) {
    .mj-column-per-100, * [aria-labelledby="mj-column-per-100"] { width:100%!important; }
  }
</style>
</head>
<body>
  <div><!--[if mso]>
      <table border="0" cellpadding="0" cellspacing="0" width="600" align="center" style="width:600px;"><tr><td>
      <![endif]--><div style="margin:0 auto;max-width:600px;"><table cellpadding="0" cellspacing="0" style="font-size:0;width:100%;" align="center" border="0"><tbody><tr><td style="text-align:center;vertical-align:top;font-size:0;padding:20px 0;"><!--[if mso]>
      <table border="0" cellpadding="0" cellspacing="0"><tr><td style="vertical-align:top;width:600px;">
      <![endif]--><div aria-labelledby="mj-column-per-100" class="mj-column-per-100" style="vertical-align:top;display:inline-block;font-size:13px;text-align:left;width:100%;"><table cellpadding="0" cellspacing="0" width="100%" border="0"><tbody><tr><td style="word-break:break-word;font-size:0;padding:10px 25px;" align="left"><div style="cursor:auto;color:#000000;font-family:Ubuntu, Helvetica, Arial, sans-serif;font-size:13px;line-height:22px;">Hello World!</div></td></tr></tbody></table></div><!--[if mso]>
      </td></tr></table>
      <![endif]--></td></tr></tbody></table></div><!--[if mso]>
      </td></tr></table>
      <![endif]-->
      <!--[if mso]>
      <table border="0" cellpadding="0" cellspacing="0" width="600" align="center" style="width:600px;"><tr><td>
      <![endif]--><div></div><!--[if mso]>
      </td></tr></table>
      <![endif]--></div>
</body>
</html>

Contribute

Feel free to dive in! Open an issue or submit PRs.

mjml-loader follows the Contributor Covenant Code of Conduct.

License

MIT Β© Ramiro Silveyra d'Avila

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].