I'm trying to use gulp-jade-find-affected to rebuild with a watcher only the affected files. For example, if I do an update in a layout or mixin file, I want to rebuild only the files who includes the mixin.
But the example on the plugin's Github doesn't work since an update of gulp-watch (emitOnGlob option doesn't exist anymore).
After a research, I found this solution and I tried to adapt it for my case but it doesn't work :
var gulp = require('gulp'),
watch = require('gulp-watch'),
fs = require('fs'),
jade = require("gulp-jade"),
affected = require('gulp-jade-find-affected');
var destJade = './docs/';
gulp.task('templates', function() {
return gulp.src('src/fr_FR/pages/*.jade').pipe(watch('src/fr_FR/**/*.jade', function(files) {
return files
.pipe(affected())
.pipe(jade({
pretty: true,
data: JSON.parse(fs.readFileSync('./src/fr_FR/data/data.json', 'utf8'))
}))
.pipe(gulp.dest(destJade));
}));
});
If someone has any idea to do what I want, I'll really appreciate !
Thanks for your attention.