vinyl-fs-merge

1.0.0 • Public • Published

vinyl-fs-merge

Merges file globs from two or more source directories. First source takes precedence over the next.

npm status node

example

const merge = require('vinyl-fs-merge')
    , gulp = require('gulp')
    , imagemin = require('gulp-imagemin')
 
merge(['./my-brand', './default'], '*.png')
  .pipe(imagemin())
  .pipe(gulp.dest('dist'))

If both directories have a logo.png, then only my-brand/logo.png is copied to dist. If my-brand/logo.png does not exist, default/logo.png is copied instead.

merge(paths, glob, [options])

  • paths: array of source directories
  • glob: one or more glob patterns passed to vinyl-fs (must be relative)

Options:

  • read: if false, do not read file contents
  • cwd: custom working directory to resolve source paths
  • Other options are passed to vinyl-fs, except:
    • cwd is set to a resolved source path
    • allowEmpty is always true (meaning it doesn't fail on a singular glob)

install

With npm do:

npm install vinyl-fs-merge

license

MIT © ironSource.

Readme

Keywords

Package Sidebar

Install

npm i vinyl-fs-merge

Weekly Downloads

1

Version

1.0.0

License

MIT

Last publish

Collaborators

  • it-ironsrc
  • kessler
  • vweevers