Gulp copy file and delete file - zhentian-wan/MEANAppsFiles GitHub Wiki
Copy file
We can use gulp.src() function to tell which files you want to copy. Then use gulp.dest() function to tell the destination of those copied files.
gulp.task('copy-image', function() {
gulp.src('./public/images/**/*').pipe(gulp.dest('./build/assets/images'));
});
gulp.task('copy-app-js', function() {
gulp.src('./public/app/**/*.js').pipe(gulp.dest('./build'));
});
gulp.task('copy-vendor-js', function() {
gulp.src('./public/vendor/**/*.js').pipe(gulp.dest('./build/assets/vendor'));
});
Here we copy the file from public dir to build dir.
clean file
First need to install:
npm install del --save-dev
There are three params, first param to tell which file or dir you want to delete. Second as options, here set force to delete. Third is callback.
var del = require('del');
gulp.task('clean', function(callback){
del(['./build'], {force: true}, callback);
});