M
M
Maxim Ivanov2022-03-19 11:40:54
gulp.js
Maxim Ivanov, 2022-03-19 11:40:54

Why is gulp shutting down after 20-30 seconds?

After I added browser-sync to the assembly, the gallp began to cut down after 20-30 seconds. Why is this happening and how to fix it?

62359710a519a906063567.png

const GulpClient = require('gulp');
const { src, dest, watch, parallel } = require('gulp');

const scss = require('gulp-sass')(require('sass'));
const concat = require('gulp-concat');
const browserSync = require('browser-sync').create();

function browsersync() {
    browserSync.init({
        server: {
            baseDir: 'app/'
        }
    });
};

function styles() {
    return src('app/scss/style.scss')
        .pipe(scss({outputStyle: 'compressed'}))
        .pipe(concat('style.min.css'))
        .pipe(dest('app/css'))
        .pipe(browserSync.stream());
};

function watching() {
    watch(['app/scss/**/*.scss'], styles)
    watch(['app/*.html']).on('change', browserSync.reload);
};

exports.default = parallel(browsersync, watching);

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