Neurologically Paralyzing Mouseovers
Need private packages and team management tools?Check out npm Orgs. »

vinyl-replace

1.0.0 • Public • Published

vinyl-replace

A Vinyl plugin to replace file contents.

API

vinylReplace (transform)

Create a transform stream that applies transform to each passed file vinyl. Internally, a file vinyl is one with its contents property set to either a Buffer or Readable stream object. Any other vinyl is passed through as is.

The transform function

The transform function is any callable object accepting as input a string (the vinyl's content) and returning a possibly new version of it, that will be replaced as the new content of the vinyl.

Example

const { src, dest } = require('gulp');
const vinylReplace = require('vinyl-replace');
 
function myTask () {
  return src('*.txt')
    .pipe(vinylReplace((input) => {
      return input.replace('something', 'everything');
    }))
    .pipe(dest('dist/'));
}
 

License

This project is distributed under the BSD 3 Clause license (BSD-3-Clause). Please see the LICENSE file.

Install

npm i vinyl-replace

DownloadsWeekly Downloads

2

Version

1.0.0

License

BSD-3-Clause

Unpacked Size

7.79 kB

Total Files

6

Last publish

Collaborators

  • avatar