J
J
JastaFly2020-01-28 18:36:32
gulp.js
JastaFly, 2020-01-28 18:36:32

Gulp series runs tasks in order??

Good day to all! There is this code for Gulp:

'use strict';

var gulp = require('gulp');
var sass = require('gulp-sass');
var rename = require("gulp-rename");
var autoprefixer = require('gulp-autoprefixer');

gulp.task('sass', function (done) {
    gulp.src("scss/style.scss")
        .pipe(sass({
            outputStyle: 'compressed'
        }))
        .pipe(rename({
            suffix: '.min'
        }))
        .pipe(autoprefixer())
        .pipe(gulp.dest("css/"))
    done();
});
gulp.task('watch', function () {
    gulp.watch('scss/*.scss', gulp.series('sass'));
});

gulp.task('copy', function (done) {
    gulp.src(["**", "!scss/**", "!dist/**", "!node_modules/**", "!gulpfile.js", "!package.json", "!package-lock.json"])
        .pipe(gulp.dest("dist/"));

    done();
});

gulp.task("build", gulp.series(
    "sass",
    "copy"
));

gulp.task('default', gulp.series('build'));

And if you make changes to the SCSS file and then run gulp, then the old css file will end up in the final dist folder, although it seems like the copy task is after the sass task and like gulp.series should run them in order. Plz tell me how to fix this???

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question