From 7919e6421d92d7ad04886ae8e7b0839264310d7b Mon Sep 17 00:00:00 2001 From: Christopher Geary Date: Fri, 6 Oct 2017 18:17:14 +0100 Subject: [PATCH] Replace gulp.watch() with the gulp-watch package to detect/watch new files --- gulpfile.babel.js | 7 ++++--- package.json | 1 + 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/gulpfile.babel.js b/gulpfile.babel.js index d0f3cd0..df7da2d 100644 --- a/gulpfile.babel.js +++ b/gulpfile.babel.js @@ -6,6 +6,7 @@ import postcss from "gulp-postcss"; import cssImport from "postcss-import"; import cssnext from "postcss-cssnext"; import BrowserSync from "browser-sync"; +import watch from "gulp-watch"; import webpack from "webpack"; import webpackConfig from "./webpack.conf"; @@ -53,9 +54,9 @@ gulp.task("server", ["hugo", "css", "js"], () => { baseDir: "./dist" } }); - gulp.watch("./src/js/**/*.js", ["js"]); - gulp.watch("./src/css/**/*.css", ["css"]); - gulp.watch("./site/**/*", ["hugo"]); + watch("./src/js/**/*.js", () => { gulp.start(["js"]) }); + watch("./src/css/**/*.css", () => { gulp.start(["css"]) }); + watch("./site/**/*", () => { gulp.start(["hugo"]) }); }); /** diff --git a/package.json b/package.json index 5f8ead7..1b583ec 100644 --- a/package.json +++ b/package.json @@ -31,6 +31,7 @@ "gulp-babel": "^6.1.2", "gulp-postcss": "^6.1.1", "gulp-util": "^3.0.7", + "gulp-watch": "^4.3.11", "hugo-bin": "^0.12.0", "imports-loader": "^0.7.1", "postcss-cssnext": "^2.7.0",