-
Notifications
You must be signed in to change notification settings - Fork 78
Expand file tree
/
Copy pathgulpfile.js
More file actions
41 lines (31 loc) · 854 Bytes
/
Copy pathgulpfile.js
File metadata and controls
41 lines (31 loc) · 854 Bytes
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
/**
* Created at 09/01/2018
* By Adrien Fenech
*/
const gulp = require('gulp');
const runSequence = require('run-sequence');
const del = require('del');
const DEV_DIR = 'app';
const DIST_DIR = 'dist';
const server = require('gulp-express');
function runExpress() {
// Start the server at the beginning of the task
server.run(['server.js']);
}
gulp.task('default', ['copy-dev-to-dist', 'serve-dist', 'watch']);
gulp.task('build', function(callback) {
runSequence('copy-dev-to-dist', callback);
});
gulp.task('clean', function() {
del.sync([DIST_DIR]);
});
gulp.task('serve-dist', ['build'], function() {
runExpress(DIST_DIR);
});
gulp.task('copy-dev-to-dist', function() {
return gulp.src(DEV_DIR + '/**')
.pipe(gulp.dest(DIST_DIR));
});
gulp.task('watch', function() {
gulp.watch('app/**', ['build']);
});