I
I
Ilya Chizhov2017-03-30 15:07:44
JavaScript
Ilya Chizhov, 2017-03-30 15:07:44

How to return a gulp stream?

It doesn't give any errors to the console, but the callback is not executed, how to return the process without interrupting the cycle?

gulp.task('refreshSassTemp', function (done) {
    let items = fs.readdirSync('./placeholders');

    for (let j = 0; j <= items.length - 1; j++) {
        let scss = fs.existsSync('./placeholders/' + items[j] + '/public_html/scss/main.scss');

        if (scss) {
                // del('temp/' + items[j] + '/css/main.css');
                gulp.src([
                    'placeholders/' + items[j] + '/public_html/scss/main.scss'
                ])
                    .pipe(sass().on('error', sass.logError))
                    .pipe(postcss([autoprefixer({browsers: ['last 2 versions']})]))
                    .pipe(csso())
                    .pipe(gulp.dest('temp/' + items[j] + '/css'));

        } else {
                // del('temp/' + items[j] + '/css/main.css');
                gulp.src([
                    'app/scss/main.scss'
                ])
                    .pipe(sass().on('error', sass.logError))
                    .pipe(postcss([autoprefixer({browsers: ['last 2 versions']})]))
                    .pipe(csso())
                    .pipe(gulp.dest('temp/' + items[j] + '/css'));
        }
    }
    done()
}, gulp.series('refreshCssLibs'));

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