0

I had it working a couple weeks ago, but for some reason, the following is no longer copying my files from the assets directory to the dist directory.

const gs = gulp.series,
      gp = gulp.parallel;

gulp.task('fonts', (done) => {
    gulp.src([
            'node_modules/font-awesome/fonts/*'
        ])
    .pipe(gulp.dest(paths.dist+"/fonts/fontawesome"));
    done();
})


gulp.task('assets', gs('fonts'), (done) => {
    gulp.src([
        'assets/**/*', // all files
        'assets/**/.*', // all hidden files
        '!assets/{scripts,scripts/**}', //ignore scripts directory.
        '!assets/{stylesheets,stylesheets/**}' //ignore scripts directory.
    ])
    .pipe(gulp.dest(paths.dist));
    done();
});

It does create the fonts folder and copies the fonts from font-awesome, but that's about it.

If I remove gs('fonts') from the 'assets' tasks, it does appear to work properly.

My directory structure is:

assets

  • /fonts
  • /img
  • /scripts
  • /stylesheets
  • .htaccess
  • .robots.txt

I've tried putting the path directly to the .htaccess file and it too isn't copied over. Thoughts?

Also - if there's a better way to write this, I'm open to suggestions.

gin93r
  • 1,551
  • 4
  • 21
  • 39

1 Answers1

0

I figured it out.

gulp.task('fonts', (done) => {
    gulp.src([
            'node_modules/font-awesome/fonts/*'
        ])
    .pipe(gulp.dest(paths.dist+"/fonts/fontawesome"));
    done();
})



gulp.task('assets', gs('fonts', (done) => {
    gulp.src([
        'assets/**/*', // all files
        'assets/**/.*', // all hidden files
        '!assets/{scripts,scripts/**}', //ignore scripts directory.
        '!assets/{stylesheets,stylesheets/**}' //ignore scripts directory.
    ])
    .pipe(gulp.dest(paths.dist));
    done();
}));

My assets task was calling the 'fonts' task only because I didn't include the callback function in the gulp.series call. gs('fonts'), (done) vs gs('fonts', (done)

gin93r
  • 1,551
  • 4
  • 21
  • 39