Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

gulp-copy

klaascuvelier58.4kMIT5.0.0TypeScript support: definitely-typed

Plugin copying files to a new destination and using that destination for other actions

gulpplugin, copy, gulp

readme

npm version build status

gulp-copy

Copy source files to new destination and use that destination as new source (for further piping). Automatically creates needed folders before proceeding. Ability to remove 'prefixes' from path.

Most likely you don't need this package for your gulp pipeline, a lot can be accomplished with just gulp.dest. A reason to use this package would be to keep some depth (prefix options).

Usage

// gulpfile.js

var gulpCopy = require('gulp-copy');
var otherGulpFunction = require('gulp-other-function');
var sourceFiles = ['source1/*', 'source2/*.txt'];
var destination = 'dest/';
var outputPath = 'some-other-dest/';

return gulp
    .src(sourceFiles)
    .pipe(gulpCopy(outputPath, options))
    .pipe(otherGulpFunction())
    .dest(destination);

Options

prefix: integer, defining how many parts of the path (separated by /) should be removed from the original path

Example

A simple implemention of a gulpfile using gulp-copy is available in the example folder. You can run gulp or npx gulp from within the folder.

Updates

See changelog for all updates.

changelog

5.0.0

  • Gulp 5 support

4.0.0

  • Gulp 4 support

1.1.0

  • Replace deprecated gulp-util, thx to @demurgos and @grig0ry

1.0.1

  • Fix for absolute paths

1.0.0

  • Require node v4
  • Require gulp 3.9.x
  • Automated tests

0.0.2 Streams release

  • use nodejs streams to write files (instead of cp command)
  • fix callback issues (which probably will fix the too many open files bug)

0.0.1 Initial release

  • initial code