@@ -21,17 +21,6 @@ var paths = {
2121 pug : './index.pug'
2222}
2323
24- //
25- // Internal watch triggers
26- //
27-
28- gulp . task ( '_watch' , function ( ) {
29- gulp . watch ( paths . styles . watch , gulp . series ( 'default' ) )
30- gulp . watch ( paths . pug , gulp . series ( 'pug' ) )
31- gulp . watch ( paths . config , gulp . series ( 'pug' ) )
32- gulp . watch ( paths . images , gulp . series ( 'pug' ) )
33- } )
34-
3524//
3625// Build style.css
3726//
@@ -74,6 +63,23 @@ gulp.task( 'pug', function() {
7463 . pipe ( gulp . dest ( './' ) )
7564} )
7665
66+ //
67+ // Watch file changes and trigger build tasks
68+ //
69+
70+ gulp . task ( '_watch' , function ( ) {
71+ // Task watch wrapper that prevents an error from bubbling up and stopping the watch process
72+ function gulpWatch ( globs , fn ) {
73+ gulp . watch ( globs , fn )
74+ . on ( 'error' , function ( ) { this . emit ( 'end' ) } )
75+ }
76+
77+ gulpWatch ( paths . styles . watch , gulp . series ( 'default' ) )
78+ gulpWatch ( paths . pug , gulp . series ( 'pug' ) )
79+ gulpWatch ( paths . config , gulp . series ( 'pug' ) )
80+ gulpWatch ( paths . images , gulp . series ( 'pug' ) )
81+ } )
82+
7783//
7884// The default task is to build the product
7985//
0 commit comments