From 2219755d63d26a593e6cab0e5dcef0d20b4e329d Mon Sep 17 00:00:00 2001 From: Dan Allen Date: Sun, 30 Dec 2018 14:05:46 -0700 Subject: [PATCH] rename previewServe task function to serve --- gulpfile.js/index.js | 4 ++-- gulpfile.js/tasks/preview-serve.js | 10 ---------- gulpfile.js/tasks/serve.js | 10 ++++++++++ 3 files changed, 12 insertions(+), 12 deletions(-) delete mode 100644 gulpfile.js/tasks/preview-serve.js create mode 100644 gulpfile.js/tasks/serve.js diff --git a/gulpfile.js/index.js b/gulpfile.js/index.js index c9f01b8..cf95f35 100644 --- a/gulpfile.js/index.js +++ b/gulpfile.js/index.js @@ -11,7 +11,7 @@ const srcDir = 'src' const destDir = `${previewDestDir}/_` const { reload: livereload } = process.env.LIVERELOAD === 'true' ? require('gulp-connect') : {} -const { remove, lintCss, lintJs, format, build, pack, previewPages, previewServe } = require('./tasks') +const { remove, lintCss, lintJs, format, build, pack, previewPages, serve } = require('./tasks') const glob = { all: [srcDir, previewSrcDir], css: `${srcDir}/css/**/*.css`, @@ -84,7 +84,7 @@ const previewBuildTask = task({ const previewServeTask = task({ name: 'preview:serve', - call: previewServe(previewDestDir, { port: 5252, livereload }, () => watch(glob.all, previewBuildTask)), + call: serve(previewDestDir, { port: 5252, livereload }, () => watch(glob.all, previewBuildTask)), }) const previewTask = task({ diff --git a/gulpfile.js/tasks/preview-serve.js b/gulpfile.js/tasks/preview-serve.js deleted file mode 100644 index c9a9c25..0000000 --- a/gulpfile.js/tasks/preview-serve.js +++ /dev/null @@ -1,10 +0,0 @@ -'use strict' - -const connect = require('gulp-connect') - -module.exports = (serveDir, opts = {}, watch = undefined) => (done) => { - connect.server({ ...opts, root: serveDir }, function () { - this.server.on('close', done) - if (watch) watch() - }) -} diff --git a/gulpfile.js/tasks/serve.js b/gulpfile.js/tasks/serve.js new file mode 100644 index 0000000..82ee933 --- /dev/null +++ b/gulpfile.js/tasks/serve.js @@ -0,0 +1,10 @@ +'use strict' + +const connect = require('gulp-connect') + +module.exports = (root, opts = {}, watch = undefined) => (done) => { + connect.server({ ...opts, root }, function () { + this.server.on('close', done) + if (watch) watch() + }) +} -- 2.11.0