Gulp tasks remove content from assets/ directory

Hello,

I have this problem that when I drop my video assets in the assets/ directory into videos/ folder, they get removed by one of the gulp tasks when running gulp or gulp --production.

It appears that in the current setup only fonts, images, scripts and styles are expected to live in the assets directory.

How can I make Gulp NOT remove additional assets that I might drop into this folder?

Thanks!

Itā€™s the gulp clean task that is removing your additional folders when processing and then moving to /dist/. See here: https://github.com/roots/sage/blob/master/gulpfile.js#L238

Iā€™d recommend making a new ā€œvideosā€ task and just having that copy over each of the files, but thereā€™s probably a few ways to skin that cat.

1 Like

This is exactly what I did, thanks

Any chance youā€™d be willing to share that task? Iā€™m trying to do the exact same thing.

@roryatbrightoak,

Iā€™ve taken a very simple approach:

Added a ā€˜videosā€™ task that just copies files:

 gulp.task('videos', function() {
     return gulp.src(path.source + 'video/*')
         .pipe(gulp.dest(path.dist + 'video'))
 });

next,included the task in the build process:

gulp.task('build', function(callback) {
  runSequence('styles',
              'scripts',
              'videos',
              ['fonts', 'images'],
              callback);
});