From fa36ac33977d8c81774ddbd11e85c3c059afd8a4 Mon Sep 17 00:00:00 2001 From: kendo5731 Date: Thu, 22 Oct 2015 17:38:24 +0200 Subject: [PATCH] feat(sass): automatically reload browser when a sass file is modified --- build/tasks/serve.js | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/build/tasks/serve.js b/build/tasks/serve.js index 20bc49d..3d77ed9 100644 --- a/build/tasks/serve.js +++ b/build/tasks/serve.js @@ -1,11 +1,11 @@ - import gulp from 'gulp'; import util from 'gulp-util'; import browserSync from 'browser-sync'; import runSequence from 'run-sequence'; import modRewrite from 'connect-modrewrite'; +import paths from '../paths'; -function browerSync(directoryBase, files, browser) { +function startBrowserSync(directoryBase, files, browser) { browser = browser === undefined ? 'default' : browser; files = files === undefined ? 'default' : files; @@ -25,5 +25,8 @@ function browerSync(directoryBase, files, browser) { } gulp.task('serve', () => { - return browerSync(['public', './' ]); -}); \ No newline at end of file + startBrowserSync([paths.srcDir, './' ]); + gulp.watch(`${paths.srcDir}/**/*.scss`, ['sass', () => { + browserSync.reload(); + }]); +});