Michsior14 / webpack-mjml-plugin

๐Ÿ“ฎ Webpack MJML plugin for compiling MJML files.

Home Page:https://www.npmjs.com/package/webpack-mjml-plugin

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Webpack MJML Plugin - Logo

Webpack MJML Plugin for compiling .mjml files.

Prettier Known Vulnerabilities GitHub CI Build NPM Package Downloads 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/*.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. The string supports glob syntax ex: path/to/mjml/**/*.mjml
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.

https://www.npmjs.com/package/webpack-mjml-plugin

License:MIT License


Languages

Language:JavaScript 93.7%Language:Shell 6.3%