https://github.com/matteobertoldo/webpack-mjml-plugin
📮 Webpack MJML plugin for compiling MJML files.
https://github.com/matteobertoldo/webpack-mjml-plugin
mjml mjml-framework mjml-to-html webpack webpack-plugin
Last synced: 22 days ago
JSON representation
📮 Webpack MJML plugin for compiling MJML files.
- Host: GitHub
- URL: https://github.com/matteobertoldo/webpack-mjml-plugin
- Owner: matteobertoldo
- License: mit
- Created: 2022-05-31T13:06:41.000Z (almost 3 years ago)
- Default Branch: master
- Last Pushed: 2025-01-29T15:55:49.000Z (4 months ago)
- Last Synced: 2025-04-30T14:29:53.418Z (22 days ago)
- Topics: mjml, mjml-framework, mjml-to-html, webpack, webpack-plugin
- Language: JavaScript
- Homepage: https://www.npmjs.com/package/webpack-mjml-plugin
- Size: 3.54 MB
- Stars: 4
- Watchers: 1
- Forks: 5
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Contributing: CONTRIBUTING.md
- Funding: .github/FUNDING.yml
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
README
![]()
Webpack MJML Plugin for compiling
.mjml
files.---
## Installation :gift:
```sh
npm install webpack-mjml-plugin
```## Usage :joystick:
In your `webpack.config.js` simply:
```javascript
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 :bee:
The plugin supports all `options` that can be found in [this documentation](https://documentation.mjml.io/#inside-node-js).
```js
// webpack.config.jsmodule.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](https://github.com/isaacs/node-glob#glob-primer) 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 :busts_in_silhouette:
Please read [CONTRIBUTING.md](https://github.com/matteobertoldo/webpack-mjml-plugin/blob/master/CONTRIBUTING.md) for details on code of conduct, and the process for submitting pull requests.
## License :balance_scale:
Webpack MJML Plugin is licensed under the MIT License - see the [LICENSE.md](https://github.com/matteobertoldo/webpack-mjml-plugin/blob/master/LICENSE) file for details.