Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rewrote gulp watch functions to include watch.options from config #36

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions config.default.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,11 @@
module.exports = {
watch: {
options: {
// Uncomment 2 lines below to allow polling which necessary to run gulp-watch in a docker container on windows.
// interval: 1000,
// usePolling: true,
}
},
css: {
enabled: true,
src: [
Expand Down
2 changes: 1 addition & 1 deletion lib/css.js
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ module.exports = (gulp, config, tasks) => {
const src = config.css.extraWatches
? [].concat(config.css.src, config.css.extraWatches)
: config.css.src;
return gulp.watch(src, gulp.parallel(watchTasks));
return gulp.watch(src, config.watch.options, gulp.parallel(watchTasks));
}

watchCss.description = 'Watch Scss';
Expand Down
2 changes: 1 addition & 1 deletion lib/drupal.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ module.exports = (gulp, config, tasks) => {
gulp.task('cc', clearDrupalCache);

gulp.task('watch:drupal', () => {
gulp.watch(config.drupal.watch, clearDrupalCache);
gulp.watch(config.drupal.watch, config.watch.options, clearDrupalCache);
});
tasks.watch.push('watch:drupal');
};
2 changes: 1 addition & 1 deletion lib/icons.js
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ module.exports = (gulp, config, tasks) => {
src.push(config.icons.templates.css.src);
src.push(config.icons.templates.demo.src);
}
return gulp.watch(src, icons);
return gulp.watch(src, config.watch.options, icons);
}

watchIcons.description = 'Watch icons';
Expand Down
6 changes: 3 additions & 3 deletions lib/js.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ module.exports = (gulp, config, tasks) => {
if (config.js.eslint.enabled) {
gulp.task('validate:js', () => validateJs().pipe(eslint.failAfterError()));
tasks.validate.push('validate:js');
gulp.task('watch:validate:js', () => gulp.watch(config.js.eslint.src, validateJs));
gulp.task('watch:validate:js', () => gulp.watch(config.js.eslint.src, config.watch.options, validateJs));
tasks.watch.push('watch:validate:js');
}

Expand All @@ -48,7 +48,7 @@ module.exports = (gulp, config, tasks) => {

gulp.task('js', compileJs);

gulp.task('watch:js', () => gulp.watch(config.js.src, compileJs));
gulp.task('watch:js', () => gulp.watch(config.js.src, config.watch.options, compileJs));

gulp.task('clean:js', (done) => {
del([
Expand Down Expand Up @@ -104,7 +104,7 @@ module.exports = (gulp, config, tasks) => {
// @todo remove `config.patternLab.bowerBasePath` in v10.0.0
const bowerBasePath = config.js.bowerBasePath || config.patternLab.bowerBasePath || './';
gulp.task('watch:bower', () => {
gulp.watch(path.join(bowerBasePath, 'bower.json'), gulp.series('js:bundleBower'));
gulp.watch(path.join(bowerBasePath, 'bower.json'), config.watch.options, gulp.series('js:bundleBower'));
});
tasks.compile.push('js:bundleBower');
tasks.watch.push('watch:bower');
Expand Down
4 changes: 2 additions & 2 deletions lib/pattern-lab--php-twig.js
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ module.exports = (gulp, config, tasks) => {

gulp.task('watch:pl:scss-to-json', () => {
const files = config.patternLab.scssToJson.map(file => file.src);
gulp.watch(files, scssToJson);
gulp.watch(files, config.watch.options, scssToJson);
});
tasks.watch.push('watch:pl:scss-to-json');
}
Expand Down Expand Up @@ -190,7 +190,7 @@ module.exports = (gulp, config, tasks) => {
: plGlob;
// plBuild goes last after any deps
watchTriggeredTasks.push(plBuild);
gulp.watch(src, gulp.series(watchTriggeredTasks));
gulp.watch(src, config.watch.options, gulp.series(watchTriggeredTasks));
});

tasks.watch.push('watch:pl');
Expand Down