-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
32 lines (27 loc) · 888 Bytes
/
gulpfile.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
var gulp = require('gulp');
var webserver = require('gulp-webserver');
var mjml = require('gulp-mjml');
var clean = require('gulp-clean');
var argv = require('yargs').argv
var SERVER_PORT = 8000 || argv.port;
var emailFolder = argv.emailFolder ? ('/' + argv.emailFolder) : '';
var distFolder = 'dist';
var srcFolder = 'src';
gulp.task('webserver', function() {
return gulp.src('./' + srcFolder + emailFolder + '/')
.pipe(webserver({
livereload: true,
open: false,
port: SERVER_PORT,
}));
});
gulp.task('mjml', function() {
console.log('--- compile html ---');
gulp.src(srcFolder + emailFolder + '/*.mjml')
.pipe(mjml())
.pipe(gulp.dest(srcFolder + emailFolder));
});
gulp.task('watch', function() {
return gulp.watch([srcFolder + '/**/*.mjml', srcFolder + '/**/*!.html'], ['mjml']);
});
gulp.task('default', ['mjml', 'watch', 'webserver']);