S
S
Senseich2019-07-24 01:39:20
gulp.js
Senseich, 2019-07-24 01:39:20

Why does the task not work out completely?

Hello! Help me understand why the task does not work completely. There is a final dist directory . I created a clean task that removes the dist directory , then I created a task that collects dist , but must first perform clean . But at startup, the dist directory is deleted, and the project is not built back.
The following is in the console:

[01:30:58] Using gulpfile ~\Desktop\box\gulpfile.js
[01:30:58] Starting 'dist'...
[01:30:58] Starting 'clean'...
[01:30:58] Finished 'clean' after 52 ms
[01:30:58] Finished 'dist' after 73 ms

Here are the tasks themselves:
gulp.task('clean', function() {
    return gulp.src('dist', { read: false })
        .pipe(clean());
});

gulp.task('dist', gulp.series('clean'), function() {
    return gulp.src('app/*.html')
        .pipe(useref())
        .pipe(gulpif('*.js', uglify()))
        .pipe(gulpif('*.css', cleanCSS()))
        .pipe(gulp.dest('dist'));
});

I did everything according to the video, everything works fine there, though on Gulp 3 ... But I changed, as in the documentation, such a design ['clean']to this gulp.series('clean'). Without it, both commands work as they should ... I also tried it, the same result. What am I doing wrong, tell me. gulp.parallel('clean')

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Stockholm Syndrome, 2019-07-24
@Senseich

and so?

function dist() {
    return gulp.src('app/*.html')
        .pipe(useref())
        .pipe(gulpif('*.js', uglify()))
        .pipe(gulpif('*.css', cleanCSS()))
        .pipe(gulp.dest('dist'));
}

gulp.task('dist', gulp.series('clean', dist));

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question