I try to sort through files, substitute text in some and save only changed. In my current code gulp-changed
does nothing.
const gulp = require('gulp');
const changed = require('gulp-changed');
const replace = require('gulp-replace');
gulp.task('text-replace', function(){
var before = 'xxx';
var after = 'yyy';
gulp.src('src/**/*')
.pipe(replace(before, after))
.pipe(changed('src'))
.pipe(gulp.dest('dest'));
});
UPDATE: I almost solved this myself, but there is a small issue related to gulp-cached
in my answer down below.