dshemendiuk / gulp-npm-dist

Copy minified (dist) files of modules listed in package.json "dependencies" field to your build path
26 stars 3 forks source link

Plugin does not return a stream #8

Open smohadjer opened 6 years ago

smohadjer commented 6 years ago

I had a problem in my build that after some hours of debugging I realised was due to gulp-npm-dist not returning a stream. Gulp guidelines recommend that every plugin should return a stream (see item 6 in guidelines).

Gulp plugin guidelines: https://github.com/gulpjs/gulp/blob/master/docs/writing-a-plugin/guidelines.md

Dealing with streams: https://github.com/gulpjs/gulp/blob/master/docs/writing-a-plugin/dealing-with-streams.md

Meanwhile usage examples in README.md should be updated to store the current stream in a variable and return it after plugin is invoked to avoid problems due to lack of support for streams.

bharatribadiya commented 4 years ago
var gulp = require('gulp');
var npmDist = require('gulp-npm-dist');

// Copy dependencies to ./public/libs/
gulp.task('copy:libs', function() {
  return gulp.src(npmDist(), {base:'./node_modules'})
    .pipe(gulp.dest('./public/libs'));
});