Skip to content

Humanoidfr/webpack-mjml-plugin

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

70 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Webpack MJML Plugin - Logo

Webpack MJML Plugin for compiling MJML files.

Prettier Known Vulnerabilities Travis CI Build NPM Package Version


Installation 🎁

npm install webpack-mjml-plugin

Usage 🕹️

In your webpack.config.js simply:

const MJMLPlugin = require('webpack-mjml-plugin');

module.exports = {
  // ...
  plugins: [
    new MJMLPlugin('src/to/mjml', {
      extension: '.html',
      outputPath: path.resolve(__dirname, 'dist/to/mjml')
    });
  ]
};

API 🐝

The plugin supports all options that can be found in this documentation.

// webpack.config.js

module.exports = {
  plugins: [
    new MJMLPlugin(inputPath, {
      extension: options.extension,
      outputPath: options.outputPath,
      // MJML options (https://documentation.mjml.io/#inside-node-js)
      filePath: path.resolve(__dirname, 'src/to/mjml'),
      keepComments: false
    })
  ]
};

In addition to the options available in the MJML documentation, there are 3 additional parameters described in the table below:

Parameter Type Default Description
inputPath string undefined The path where .mjml files are located.
options.extensions string .html The default output extension.
options.outputPath string process.cwd() The path where compiled files should be written to.

Contributing 👥

Please read CONTRIBUTING.md for details on code of conduct, and the process for submitting pull requests.

License ⚖️

NPM License

Webpack MJML Plugin is licensed under the MIT License - see the LICENSE.md file for details.

About

📮 Webpack MJML plugin for compiling MJML files.

Resources

License

Code of conduct

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 93.3%
  • Shell 6.7%