From 88ccb6b35be3a332fbfd9e7c10a698095ba57077 Mon Sep 17 00:00:00 2001 From: Klaus Klein Date: Fri, 2 Nov 2018 15:53:24 +0100 Subject: [PATCH] server-preview: ensure hugo-preview is run for subsequent builds (#131) --- gulpfile.babel.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/gulpfile.babel.js b/gulpfile.babel.js index 796dfef..c937555 100644 --- a/gulpfile.babel.js +++ b/gulpfile.babel.js @@ -23,7 +23,7 @@ gulp.task("hugo-preview", (cb) => buildSite(cb, hugoArgsPreview)); // Run server tasks gulp.task("server", ["hugo", "css", "js", "fonts"], (cb) => runServer(cb)); -gulp.task("server-preview", ["hugo-preview", "css", "js", "fonts"], (cb) => runServer(cb)); +gulp.task("server-preview", ["hugo-preview", "css", "js", "fonts"], (cb) => runServer(cb, "hugo-preview")); // Build/production tasks gulp.task("build", ["css", "js", "fonts"], (cb) => buildSite(cb, [], "production")); @@ -61,7 +61,7 @@ gulp.task('fonts', () => ( )); // Development server with browsersync -function runServer() { +function runServer(cb, hugoTask = "hugo") { browserSync.init({ server: { baseDir: "./dist" @@ -70,7 +70,7 @@ function runServer() { gulp.watch("./src/js/**/*.js", ["js"]); gulp.watch("./src/css/**/*.css", ["css"]); gulp.watch("./src/fonts/**/*", ["fonts"]); - gulp.watch("./site/**/*", ["hugo"]); + gulp.watch("./site/**/*", [hugoTask]); }; /**