From: Aileen Nowak Date: Mon, 15 Apr 2019 04:42:39 +0000 (+0800) Subject: Added livereload for .hbs files X-Git-Url: https://git.njae.me.uk/?p=editorial.git;a=commitdiff_plain;h=55b8c3714d4e9687629821abd2c80e34737ab4ce Added livereload for .hbs files --- diff --git a/gulpfile.js b/gulpfile.js index ea46129..373515f 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -1,4 +1,4 @@ -const { series, watch, src, dest } = require('gulp'); +const {series, watch, src, dest, parallel} = require('gulp'); const pump = require('pump'); // gulp plugins and utils @@ -23,11 +23,18 @@ const handleError = (done) => { sass.compiler = require('node-sass'); +function hbs(done) { + pump([ + src(['*.hbs', 'partials/**/*.hbs', '!node_modules/**/*.hbs']), + livereload() + ], handleError(done)); +} + function css(done) { pump([ - src('./assets/main/sass/*.scss', { sourcemaps: true }), - sass({ outputStyle: 'compressed' }).on('error', sass.logError), - dest('assets/main/css', { sourcemaps: './' }), + src('./assets/main/sass/*.scss', {sourcemaps: true}), + sass({outputStyle: 'compressed'}).on('error', sass.logError), + dest('assets/main/css', {sourcemaps: './'}), livereload() ], handleError(done)); } @@ -48,7 +55,9 @@ function zipper(done) { ], handleError(done)); } -const watcher = () => watch('./assets/main/sass/**/**', css); +const cssWatcher = () => watch('./assets/main/sass/**/**', css); +const hbsWatcher = () => watch(['*.hbs', 'partials/**/*.hbs', '!node_modules/**/*.hbs'], hbs); +const watcher = parallel(cssWatcher, hbsWatcher); const build = series(css); const dev = series(build, serve, watcher);