diff --git a/gulpfile.js b/gulpfile.js index 70a838f504..fd82ad3ab4 100755 --- a/gulpfile.js +++ b/gulpfile.js @@ -16,20 +16,10 @@ gulp.task('jekyll-build', function (done) { }); // Rebuild Jekyll and page reload -gulp.task('jekyll-rebuild', ['jekyll-build'], function () { +gulp.task('jekyll-rebuild', function () { browserSync.reload(); }); -// Wait for jekyll-build, then launch the Server -gulp.task('browser-sync', ['sass', 'img', 'jekyll-build'], function() { - browserSync({ - server: { - baseDir: '_site' - }, - notify: false - }); -}); - // Compile files gulp.task('sass', function () { return gulp.src('assets/css/scss/main.scss') @@ -56,13 +46,23 @@ gulp.task('img', function() { .pipe(browserSync.reload({stream:true})); }); +// Wait for jekyll-build, then launch the Server +gulp.task('browser-sync', gulp.series('sass', 'img', 'jekyll-build'), function() { + browserSync({ + server: { + baseDir: '_site' + }, + notify: false + }); +}); + // Watch scss, html, img files gulp.task('watch', function () { - gulp.watch('assets/css/scss/**/*.scss', ['sass']); - gulp.watch('assets/js/**/*.js', ['jekyll-rebuild']); - gulp.watch('assets/img/**/*', ['img']); - gulp.watch(['*.html', '_layouts/*.html', '_includes/*.html', '_pages/*.html', '_posts/*'], ['jekyll-rebuild']); + gulp.watch('assets/css/scss/**/*.scss', gulp.series('sass')); + gulp.watch('assets/js/**/*.js', gulp.series('jekyll-rebuild')); + gulp.watch('assets/img/**/*', gulp.series('img')); + gulp.watch(['*.html', '_layouts/*.html', '_includes/*.html', '_pages/*.html', '_posts/*'], gulp.series('jekyll-rebuild')); }); // Default task -gulp.task('default', ['browser-sync', 'watch']); +gulp.task('default', gulp.series('browser-sync', 'watch')); diff --git a/package.json b/package.json index d70921d143..72a8eab257 100644 --- a/package.json +++ b/package.json @@ -9,11 +9,11 @@ "dependencies": { "browser-sync": "^2.18.13", "child_process": "^1.0.2", - "gulp": "^3.9.1", + "gulp": "^4.0.2", "gulp-autoprefixer": "^4.0.0", "gulp-cache": "^0.4.6", - "gulp-imagemin": "^3.2.0", + "gulp-imagemin": "^7.1.0", "gulp-sass": "^3.1.0", - "imagemin-pngquant": "^5.0.0" + "imagemin-pngquant": "^9.0.2" } }