The problem with browserSync does not track changes in files. The problem is noticed on Windows OS on OSX everything is working fine.
const gulp = require('gulp'); const browserSync = require('browser-sync'); const reload = browserSync.reload; const twig = require('gulp-twig'); const PATHS = { src: 'src/', dist: 'dist/' }; gulp.task('views',() => gulp.src(PATHS.src + 'views/*.twig') .pipe(twig()) .pipe(gulp.dest(PATHS.dist + '/views')) ); gulp.task('serve', ['views'], () => { browserSync({ notify: false, port: 9000, server: { baseDir: [PATHS.dist + 'views', PATHS.dist] } }); gulp.watch([PATHS.src +'views/**/*.twig'], ['views']).on('change', reload);
At change of files * .twig task the views are not called
gulp.src(PATHS.src + 'views/*.twig')
works with files only from the views folder, andgulp.watch([PATHS.src +'views/**/*.twig'], ['views'])
looks at the files in the views folder and under the folders, maybe there is an error here and you need to makegulp.src(PATHS.src + 'views/**/.*.twig')
in the views tax. - stackanon