gulp-src-ex

0.0.9 • Public • Published

gulp-src-ex

Extend the gulp.src functionality. It fails when full paths are passed and the file does not exist and allows multiple globs to multiple dest

Usage

Basic Usage

const gsrc = require( 'gulp-src-ex' )
 
// Default usage
gulp.task( '...', function() {
  // Every file must exist unless a glob is passed
  return gsrc([ 'file1.js', 'file2.js', 'file{3..9}.js', '**/*.js'] )
    .pipe( gulp.dest( 'build' ) );
});
 
// Extended usage
gulp.task( '...', function() {
  return gsrc({
    '': [ 'path/to/file.js' ],
    // Files to pass to test output folder
    'test': [ 'path/to/{file1,file2,another-file}.js' ]
  }).pipe( gulp.dest( 'build' ) ); 
  // build/file.js
  // build/test/file1.js
  // build/test/file2.js
  // build/test/another-file.js
});

y

gsrc( files[, options] )

  • files: String, Array or Object

    • When array, every path will be used as a
    • When object, keys will be a base dest folder to prepend to the outputted filename.
    {
      '':          'src/myfile.js',
      'test':      [ 'src/braces{1,2,3}.js' ],
      'test/data': [ 'src/myotherfile.js', 'src/path/**/*.js' ]
    }

    will output myfile.js, 'test/braces1.js', 'test/braces2.js', 'test/braces3.js', test/data/myotherfile.js, test/data/other/file.js...

  • options.ignore {Array}: Global of globs to ignore.

  • options.read: when false, files will have null content

  • options.buffer: when false, files will be read as stream

  • options.base: COMPATIBILITY ONLY, do not use. Base for every glob.

  • options.pass: Input files will be passed through this stream (Use when on the middle of a pipe)

  • options.watch: when true the stream will never close and keep emitting files

gsrc.add( files[, options] )

Same as gsrc, but with options.pass = true

Dependents (0)

Package Sidebar

Install

npm i gulp-src-ex

Weekly Downloads

1

Version

0.0.9

License

ISC

Last publish

Collaborators

  • renanhangai