Skip to content

Commit 8c3a3c0

Browse files
committed
Switch to gulp 4
1 parent 6d559ab commit 8c3a3c0

File tree

6 files changed

+10572
-8588
lines changed

6 files changed

+10572
-8588
lines changed

.babelrc

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
11
{
2-
"presets": ["env"]
2+
"presets": [
3+
"@babel/preset-env"
4+
]
35
}

.github/workflows/build-and-deploy.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ jobs:
1212

1313
strategy:
1414
matrix:
15-
node-version: [8.x]
15+
node-version: [12.x]
1616

1717
steps:
1818
- uses: actions/checkout@v1

gulpfile.babel.js

+18-31
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
const gulp = require('gulp');
1818
const $ = require('gulp-load-plugins')();
1919
const del = require('del');
20-
const runSequence = require('run-sequence');
2120
const browserSync = require('browser-sync');
2221
const reload = browserSync.reload;
2322
const merge = require('merge-stream');
@@ -134,13 +133,10 @@ gulp.task('clean', cb => {
134133
cb();
135134
});
136135

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(); }
142137

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', () => {
144140
browserSync({
145141
notify: false,
146142
// Run as an https by uncommenting 'https: true'
@@ -153,30 +149,18 @@ gulp.task('__serve__', ['copy', 'styles', 'html', 'webpack'], () => {
153149
port: 3000,
154150
});
155151

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));
159156

160157
if (webpackInstance) {
161158
webpackInstance.watch({}, (err, stats) => {
162159
printWebpackStats(stats);
163160
reload();
164161
});
165162
}
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+
}));
180164

181165
gulp.task('service-worker', () => {
182166
return workboxBuild.injectManifest({
@@ -200,13 +184,16 @@ gulp.task('service-worker', () => {
200184
});
201185

202186
// 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+
}));
210197

211198
// Deploy to GitHub pages
212199
gulp.task('deploy', () => {

0 commit comments

Comments
 (0)