Skip to content Skip to sidebar Skip to footer

Target Only The Contents Of A Folder In Gulp

I'm using Gulp to compile a project. I'm also using gulp-zip to zip a bunch of files. I want to zip up all the files in the 'dist' folder, so I'm using this: var thesrc: ['dist/**/

Solution 1:

gulp-zip doesn't honor base. See for some background:

Now, you can do something like that (admittedly ugly):

var gulp = require('gulp');
var zip = require('gulp-zip');
var thesrc = ['**/*'];
gulp.task('createMainZip', function () {
  return gulp.src(thesrc, {cwd: __dirname + "/dist"})
  .pipe(zip('main_files.zip'))
  .pipe(gulp.dest('compiled'));
});

Solution 2:

Solution 3:

For me, following did work:

// Taking everything from src and doc dirsreturn gulp.src(['src/**/*', 'doc/**/*'], { base: __dirname })
  .pipe(zip('dist.zip'))
  .pipe(gulp.dest('dist'));

Post a Comment for "Target Only The Contents Of A Folder In Gulp"