-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgulpfile.js
executable file
·46 lines (39 loc) · 1010 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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
var gulp = require('gulp'),
plumber = require('gulp-plumber'),
gutil = require('gulp-util'),
mjml = require('gulp-mjml'),
browserSync = require('browser-sync'),
reload = browserSync.reload;
// File path variables
var basePaths = {
src: 'mjml/',
dest: 'output/'
};
var paths = {
html: {
src: basePaths.src + 'index.mjml',
dest: basePaths.dest + ''
},
includes: {
src: basePaths.src + 'includes/*.mjml'
}
};
// Tasks
// Static server
gulp.task('browser-sync', function() {
browserSync.init({
server: {
baseDir: "output/"
}
});
});
gulp.task('watch', function() {
gulp.watch(paths.html.src, ['html']).on('change', reload);
gulp.watch(paths.includes.src, ['html']).on('change', reload);
});
gulp.task('html', function() {
return gulp.src(paths.html.src)
.pipe(mjml())
.pipe(gulp.dest(paths.html.dest))
});
gulp.task('default', ['browser-sync','watch']);