17
17
const gulp = require ( 'gulp' ) ;
18
18
const $ = require ( 'gulp-load-plugins' ) ( ) ;
19
19
const del = require ( 'del' ) ;
20
- const runSequence = require ( 'run-sequence' ) ;
21
20
const browserSync = require ( 'browser-sync' ) ;
22
21
const reload = browserSync . reload ;
23
22
const merge = require ( 'merge-stream' ) ;
@@ -134,13 +133,10 @@ gulp.task('clean', cb => {
134
133
cb ( ) ;
135
134
} ) ;
136
135
137
- // Watch Files For Changes & Reload
138
- gulp . task ( 'serve' , cb => {
139
- DEV_MODE = true ;
140
- runSequence ( '__serve__' , cb ) ;
141
- } ) ;
136
+ const setDevMode = cb => { DEV_MODE = true ; cb ( ) ; }
142
137
143
- gulp . task ( '__serve__' , [ 'copy' , 'styles' , 'html' , 'webpack' ] , ( ) => {
138
+ // Watch Files For Changes & Reload
139
+ gulp . task ( 'serve' , gulp . series ( setDevMode , 'copy' , 'styles' , 'html' , 'webpack' , ( ) => {
144
140
browserSync ( {
145
141
notify : false ,
146
142
// Run as an https by uncommenting 'https: true'
@@ -153,30 +149,18 @@ gulp.task('__serve__', ['copy', 'styles', 'html', 'webpack'], () => {
153
149
port : 3000 ,
154
150
} ) ;
155
151
156
- gulp . watch ( [ 'app/**/*.html' ] , [ 'html' , reload ] ) ;
157
- gulp . watch ( [ 'app/**/*.{scss,css}' ] , [ 'styles' , reload ] ) ;
158
- gulp . watch ( [ 'app/res/**/*' ] , [ 'res' , reload ] ) ;
152
+ let r = ( ) => reload ( ) ;
153
+ gulp . watch ( [ 'app/**/*.html' ] , gulp . series ( 'html' , r ) ) ;
154
+ gulp . watch ( [ 'app/**/*.{scss,css}' ] , gulp . series ( 'styles' , r ) ) ;
155
+ gulp . watch ( [ 'app/res/**/*' ] , gulp . series ( 'res' , r ) ) ;
159
156
160
157
if ( webpackInstance ) {
161
158
webpackInstance . watch ( { } , ( err , stats ) => {
162
159
printWebpackStats ( stats ) ;
163
160
reload ( ) ;
164
161
} ) ;
165
162
}
166
- } ) ;
167
-
168
- // Build and serve the output from the dist build
169
- gulp . task ( 'serve:dist' , [ 'default' ] , ( ) => {
170
- browserSync ( {
171
- notify : false ,
172
- // Run as an https by uncommenting 'https: true'
173
- // Note: this uses an unsigned certificate which on first access
174
- // will present a certificate warning in the browser.
175
- // https: true,
176
- server : 'dist' ,
177
- port : 3001 ,
178
- } ) ;
179
- } ) ;
163
+ } ) ) ;
180
164
181
165
gulp . task ( 'service-worker' , ( ) => {
182
166
return workboxBuild . injectManifest ( {
@@ -200,13 +184,16 @@ gulp.task('service-worker', () => {
200
184
} ) ;
201
185
202
186
// Build Production Files, the Default Task
203
- gulp . task ( 'default' , [ 'clean' ] , cb => {
204
- runSequence (
205
- 'styles' ,
206
- [ 'webpack' , 'html' , 'res' , 'copy' ] ,
207
- 'service-worker' ,
208
- cb ) ;
209
- } ) ;
187
+ gulp . task ( 'default' , gulp . series ( 'clean' , 'styles' , gulp . parallel ( 'webpack' , 'html' , 'res' , 'copy' ) , 'service-worker' ) ) ;
188
+
189
+ // Build and serve the output from the dist build
190
+ gulp . task ( 'serve:dist' , gulp . series ( 'default' , ( ) => {
191
+ browserSync ( {
192
+ notify : false ,
193
+ server : 'dist' ,
194
+ port : 3001 ,
195
+ } ) ;
196
+ } ) ) ;
210
197
211
198
// Deploy to GitHub pages
212
199
gulp . task ( 'deploy' , ( ) => {
0 commit comments