0.10.27 • Published 10 years ago
gulp-replacer v0.10.27
Gulp-replacer
Small plugin that can replace some token with contents of gulp stream and return result.
Installation
npm install gulp-replacer
Usage
gulp.task('task', function() {
gulp.src('replacment.html')
.pipe(replace('<!--replace-->', 'test.html', 'dest.html'))
.pipe(gulp.dest('./'));
})```
This code replace token `<!--replace-->` in file *test.html* with content of `replacement.html` and change stream filename to *dest.html* and last line write result to *dest.html* in current directory.
If you want to work with several files - use this plugin with `gulp-concat`:
gulp.task('task', function() { gulp.src('/replacement/*.html') .pipe(concat('all.html)) .pipe(replace('', 'test.html', 'test.html')) .pipe(gulp.dest('./')); })
This code works similarly with previous, but replace with all contents of *.html* files in *replacement* directory.