# gulp-mjml

> Add Gulp to your MJML workflow

Latest version **4.0.2** (published 2019-07-02) · MIT license · 0 weekly downloads

## Install

```sh
npm install gulp-mjml
pnpm add gulp-mjml
yarn add gulp-mjml
bun add gulp-mjml
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 4.0.2 |
| Published | 2019-07-02 |
| First published | 2016-01-28 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 4 |
| Unpacked size | 156.9 KB |
| Known vulnerabilities | 0 (+1 in 1 direct dependencies) |
| Install scripts | no |
| Author | Guillaume Badi |
| Maintainers | iryusa, kmcb, loeck, meriadec, mjmlio, ngarnier |
| Keywords | gulpplugin |

## Links

- npm: https://www.npmjs.com/package/gulp-mjml
- npm.io page: https://npm.io/package/gulp-mjml

## Dependencies (4)

- [mjml](https://npm.io/package/mjml.md) ^4.0.0
- [through2](https://npm.io/package/through2.md) ^3.0.1
- [replace-ext](https://npm.io/package/replace-ext.md) ^1.0.0
- [plugin-error](https://npm.io/package/plugin-error.md) ^1.0.1

## Recent versions

- 4.0.2 (latest) — 2019-07-02
- 4.0.1 — 2019-07-02
- 4.0.0 — 2019-07-02
- 3.0.0 — 2018-03-27
- 2.3.0 — 2017-10-24
- 2.2.0 — 2017-04-21
- 2.1.1 — 2017-04-12
- 2.0.0 — 2016-10-21
- 1.0.1 — 2016-05-09
- 1.0.2 — 2016-03-31
- 1.0.0 — 2016-01-28

## README

# Gulp MJML

Add MJML to your gulp workflow!

## Usage:

> With an MJML file named `test.mjml`, render your emails to an html folder:

```javascript
const gulp = require('gulp')
const mjml = require('gulp-mjml')

gulp.task('default', function () {
  return gulp.src('./test.mjml')
    .pipe(mjml())
    .pipe(gulp.dest('./html'))
})
```

> If you have custom components linked to your own `mjmlEngine`, you can pass it to the gulp task so it uses your engine to render the html:

```javascript
const gulp = require('gulp')
const mjml = require('gulp-mjml')

// Require your own components if needed, and your mjmlEngine (possibly with options)
// require('./components')
const mjmlEngine = require('mjml')

gulp.task('default', function () {
  return gulp.src('./test.mjml')
    .pipe(mjml(mjmlEngine, {minify: true}))
    .pipe(gulp.dest('./html'))
})
```

> If you'd like to get validation errors and , use `strict` and a custom error handler function. _Note that using `strict` will not render the file in case of error_:

```javascript
const gulp = require('gulp')

const mjml = require('gulp-mjml')
const mjmlEngine = require('mjml')

function handleError (err) {
  console.log(err.toString());
  this.emit('end');
}

gulp.task('default', function () {
  return gulp.src('./test.mjml')
    .pipe(mjml(mjmlEngine, {validationLevel: 'strict'}))
    .on('error', handleError)
    .pipe(gulp.dest('./html'))
})
```

---
_Source: https://npm.io/package/gulp-mjml · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
