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);
});