I am encountering a challenge with my gulp 'default' task, which is designed to clean a folder before proceeding with the minification of CSS and JS files. The issue arises when I try to ensure that the 'clean' task runs only once per default task. In my gulpfile, I have included various plugins such as gulp-clean, gulp-less, gulp-util, etc.
var gulp = require('gulp');
// including our plugins
var clean = require('gulp-clean');
var less = require('gulp-less');
var util = require('gulp-util');
// more plugin imports
// DEFAULT TASK
gulp.task('default', ['clean'], function() {
.pipe(gulp.task('vendor'))
.pipe(gulp.task('css'))
});
// clean task removes contents from public folder before build
gulp.task('clean', function() {
return gulp.src('public/**', {read: false})
.pipe(clean());
});
// javascript vendor builds
// more tasks defined in this section
Individual tasks like "gulp css" and "gulp vendor" work properly on their own. However, when I combine them into a default task with a prerequisite of running the 'clean' task first, I encounter issues. Can anyone provide insight on what might be wrong with my approach?
-Tony