Adnan Rahić
Jul 30, 2017 · 1 min read

Cool that you asked. You were very close to solving it. The only issue with your code was that you are calling the function genericCopy instead of passing it as a callback. Here’s a what I thought up just now:

gulp.task('html', copy.bind(this, 'srcHTML'));
gulp.task('css', copy.bind(this, 'srcCSS'));
gulp.task('js', copy.bind(this, 'srcJS'));
function copy(filetype) {
return gulp.src(paths[filetype]).pipe(gulp.dest(paths.tmp));
}
gulp.task('copy', ['html', 'css', 'js']);

Hope you enjoyed the article. :)

    Adnan Rahić

    Written by

    Dev/Avocado at Sematext.com. Co-Founder at Bookvar.co. Author of "Serverless JavaScript by Example"-bit.ly/sls-js. Ex-Local leader at freeCodeCamp Sarajevo.

    Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch
    Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore
    Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade