forked from Hackbyrd/express-master-boilerplate
-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
52 lines (43 loc) · 1.1 KB
/
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
47
48
49
50
51
52
/**
* Compiles Mailes and Languages
*
* yarn add gulp-cli gulp --dev --exact
*
* Run "yarn gulp" in command line terminal
*/
'use strict';
// third-party node modules
const gulp = require('gulp');
const compile = require('./mailers/compile');
const language = require('./services/language.js');
// Languages
gulp.task('languages', done =>{
language.compile();
console.log('Language locales generated.');
done();
});
// Languages watch for changes
gulp.task('languages:watch', done => {
gulp.watch(['./language/*.js', './app/**/language/*.js'], gulp.series('languages'));
done();
});
// Mailers
gulp.task('mailers', async () => {
await compile().catch(err => {
console.error(err);
process.exit(1);
});
console.log('Email previews generated.');
return Promise.resolve();
});
// Mailers watch for changes
gulp.task('mailers:watch', done => {
gulp.watch('./mailers/**/index.ejs', gulp.series('mailers'));
done();
});
// run all tasks
gulp.task('default',
gulp.series('mailers', 'mailers:watch', 'languages', 'languages:watch', done => {
console.log('Gulp finished');
})
);