server-preview: ensure hugo-preview is run for subsequent builds (#131)

This commit is contained in:
Klaus Klein 2018-11-02 15:53:24 +01:00 committed by Shawn Erquhart
parent fe54ec8e6b
commit 88ccb6b35b
1 changed files with 3 additions and 3 deletions

View File

@ -23,7 +23,7 @@ gulp.task("hugo-preview", (cb) => buildSite(cb, hugoArgsPreview));
// Run server tasks // Run server tasks
gulp.task("server", ["hugo", "css", "js", "fonts"], (cb) => runServer(cb)); 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 // Build/production tasks
gulp.task("build", ["css", "js", "fonts"], (cb) => buildSite(cb, [], "production")); gulp.task("build", ["css", "js", "fonts"], (cb) => buildSite(cb, [], "production"));
@ -61,7 +61,7 @@ gulp.task('fonts', () => (
)); ));
// Development server with browsersync // Development server with browsersync
function runServer() { function runServer(cb, hugoTask = "hugo") {
browserSync.init({ browserSync.init({
server: { server: {
baseDir: "./dist" baseDir: "./dist"
@ -70,7 +70,7 @@ function runServer() {
gulp.watch("./src/js/**/*.js", ["js"]); gulp.watch("./src/js/**/*.js", ["js"]);
gulp.watch("./src/css/**/*.css", ["css"]); gulp.watch("./src/css/**/*.css", ["css"]);
gulp.watch("./src/fonts/**/*", ["fonts"]); gulp.watch("./src/fonts/**/*", ["fonts"]);
gulp.watch("./site/**/*", ["hugo"]); gulp.watch("./site/**/*", [hugoTask]);
}; };
/** /**