This repository has been archived by the owner on Nov 30, 2017. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 19
/
Copy pathgulpfile.js
115 lines (95 loc) · 2.23 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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
/* Module Dependencies */
const gulp = require('gulp');
const browserSync = require('browser-sync');
const nodemon = require('gulp-nodemon');
/* Task Dependencies */
const bundle = require('./tasks/bundle');
const bundlemin = require('./tasks/bundlemin');
const bundledeps = require('./tasks/bundledeps');
const bundledepsdebug = require('./tasks/bundledebugdeps');
const sass = require('./tasks/sass');
gulp.task('default', ['browser-sync']);
/**
* Task Definitions
*/
gulp.task('watch-server', () => {
return nodemon({
restartable: 'rs',
verbose: false,
exec: 'npm run build && npm run debug',
watch: [
'server/src/**/*.js'
],
env: {
NODE_ENV: 'development'
},
ext: 'js json'
});
});
gulp.task('watch-lib', ['nodemon'], () => {
browserSync.init(null, {
proxy: 'http://localhost:3030',
reloadDelay: 50,
reloadDebounced: 50,
online: false,
files: [
'lib/public/**/*'
],
browser: 'google chrome',
port: 7000
});
});
gulp.task('watch-client', function (cb) {
var started = false;
return nodemon({
restartable: 'rs',
verbose: false,
exec: 'gulp bundle',
watch: [
'client/src/**/*.js'
],
env: {
NODE_ENV: 'development'
},
ext: 'js json'
}).on('start', () => {
if (!started) {
cb();
started = true;
}
});
});
gulp.task('nodemon', function (cb) {
var started = false;
return nodemon({
restartable: 'rs',
verbose: false,
env: {
NODE_ENV: 'development'
},
ext: 'js json'
}).on('start', () => {
if (!started) {
cb();
started = true;
}
});
});
gulp.task('bundle-vendor', (done) =>
bundledeps('vendor', 'bundles/js/vendor', done)
);
gulp.task('bundle-vendor-debug', (done) =>
bundledepsdebug('vendor', 'bundles/js/vendor', done)
);
gulp.task('bundle', () =>
bundlemin('client/src/main', 'main', 'bundles/js')
);
gulp.task('bundle-dev', () =>
bundle('client/src/main', 'main.min', 'bundles/js')
);
gulp.task('sass', () =>
sass('client/src/style/main.scss', 'main', 'bundles/style')
);
gulp.task('build-prod', ['bundle-vendor', 'bundle', 'sass']);
gulp.task('build', ['bundle-vendor-debug', 'bundle-dev', 'sass']);
gulp.task('dev', ['bundle-dev', 'sass']);