gulp-replacer

0.10.27 • Public • Published

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.

Readme

Keywords

Package Sidebar

Install

npm i gulp-replacer

Weekly Downloads

16

Version

0.10.27

License

WTFPL

Last publish

Collaborators

  • avotx3