Skip to content

Commit

Permalink
Merge pull request #49 from sinklair/file-extension-option
Browse files Browse the repository at this point in the history
Added output file extension option
  • Loading branch information
kmcb777 authored Aug 20, 2019
2 parents 2c5f6d0 + fbd0d37 commit 71c6d20
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
15 changes: 15 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,3 +55,18 @@ gulp.task('default', function () {
.pipe(gulp.dest('./html'))
})
```

> If you want to override the default file extension that is output use `fileExt`
```javascript
const gulp = require('gulp')
const mjml = require('gulp-mjml')

const mjmlEngine = require('mjml')

gulp.task('default', function () {
return gulp.src('./test.mjml')
.pipe(mjml(mjmlEngine, {minify: true, fileExt: ".txt"}))
.pipe(gulp.dest('./html'))
})
```
2 changes: 1 addition & 1 deletion src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ module.exports = function mjml(mjmlEngine, options) {

// [DEP0005] DeprecationWarning: Buffer() is deprecated due to security and usability issues
output.contents = Buffer.from(render.html);
output.path = replaceExt(file.path.toString(), ".html");
output.path = replaceExt(file.path.toString(), localOptions.fileExt || ".html");
this.push(output);
}
return callback();
Expand Down

0 comments on commit 71c6d20

Please sign in to comment.