Zeeshan Ahmad
Zeeshan Ahmad

Reputation: 5645

Output option not working in MJML

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.

Upvotes: 2

Views: 460

Answers (1)

Zeeshan Ahmad
Zeeshan Ahmad

Reputation: 5645

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('./'));
});

Upvotes: 1

Related Questions