Reputation: 771
I tried this code to replace foo by bar in my test.txt
var gulp = require('gulp');
var replace = require('gulp-replace-task');
gulp.task('default', function () {
gulp.src('test.txt')
.pipe(replace(
'foo',
'bar'
));
});
the content of my test.txt is
hello foo
and the text still the same
Upvotes: 0
Views: 166
Reputation: 424
It's because you are using gulp-replace-task instead of gulp-replace. They work quite a bit differently. You'll need to install gulp-replace and change your replace var to:
var replace = require('gulp-replace');
You'll also need to add:
.pipe(gulp.dest('build'));
as soyuka suggested
Upvotes: 1
Reputation: 9105
You're missing the destination, here gulp.dest('.')
.
If you don't write the file, it'll only change in-memory, and so won't show up in the result.
Upvotes: 0