I have written a gulp task to convert mjml file to html on change. Here is the code:
gulp.task('mjml:dev', function () {
return gulp.src(paths.mjmlWatch, {base: "./"})
.pipe(mjml(mjmlEngine, {
output: '.phtml'
}))
.pipe(gulp.dest('./'));
});
Everything is working fine but I want the output extension to be .phtml
. I use the output option but it is still generating the .html
extension file.
So, I solved it by installing the gulp-dest
library using:
npm i gulp-dest --save
And after that just put another pipe that is replacing the extension of the file to .phtml
.
gulp.task('mjml:dev', function () {
return gulp.src(paths.mjmlWatch, {base: "./"})
.pipe(mjml())
.pipe(dest('./', {ext: '.phtml'}))
.pipe(gulp.dest('./'));
});