9uzttg
Last Updated: July 24, 2018
·
25.65K
· iondrimba
178548

Simple Gulp Copy file task

This is just a handy way of copying a file from one folder to another.
There is no goal of replacing other tools out there.
No extra lib or package needed.

gulp.task('copy', function () {
    gulp.src('./src/templates/index.html')
        .pipe(gulp.dest('./public/'));
});
Say Thanks
Respond

1 Response
Add your response

30227

I use:

// copyTo.js v1
function copyTo(files, dest) {
if (typeof files == 'string') {
files = [files];
};
gulp.src(files).pipe(gulp.dest(dest));
console.log(cliDate() + ' copyTo success');
};

// cliDate.js v1
function cliDate() {
let date = new Date(),
hours = date.getHours(),
minutes = date.getMinutes(),
seconds = date.getSeconds();
hours < 10 ? hours = '0' + hours : hours;
minutes < 10 ? minutes = '0' + minutes : minutes;
seconds < 10 ? seconds = '0' + seconds : seconds;
return '[' + hours + ':' + minutes + ':' + seconds + ']';
};

23 days ago ·