From 88bfbc4fb09f035fcf386bf26d24908335b04823 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=A9o=20POIROUX?= Date: Thu, 1 Feb 2018 15:48:33 +0100 Subject: [PATCH] Give the opportunity to watch SASS dependencies (#1) All includePaths are now automatically watch. Useful for Wordpress to import the style of a parent theme into a child theme. --- gulpfile.js/tasks/watch.js | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/gulpfile.js/tasks/watch.js b/gulpfile.js/tasks/watch.js index 60e05bc6d..6b685e18a 100644 --- a/gulpfile.js/tasks/watch.js +++ b/gulpfile.js/tasks/watch.js @@ -32,8 +32,17 @@ var watchTask = function() { if(taskConfig) { var srcPath = projectPath(PATH_CONFIG.src, taskPath.src) var globPattern = '**/*' + (taskConfig.extensions ? '.{' + taskConfig.extensions.join(',') + '}' : '') - watch(path.join(srcPath, globPattern), watchConfig, function() { - require('./' + taskName)() + var watchPath = []; + watchPath.push(path.join(srcPath, globPattern)); + + if (taskConfig.sass !== undefined && taskConfig.sass.includePaths !== undefined) { + taskConfig.sass.includePaths.forEach(function (includePath) { + watchPath.push(path.join(includePath, globPattern)); + }); + } + + watch(watchPath, watchConfig, function () { + require('./' + taskName)() }) } })