S
S
SolidSnake132020-01-22 14:30:59
gulp.js
SolidSnake13, 2020-01-22 14:30:59

BrowserSync does not work in Gulp. What is the problem?

the temp folder contains package.json, gulpfile.js and markup, style and script files.

var gulp = require('gulp'),
    minCSS = require('gulp-clean-css'),
    sass = require('gulp-sass'),
    browserSync = require('browser-sync').create();


gulp.task('serve', ['sass'], function () {
    browserSync.init({
        server: "temp"
    });

    gulp.watch('scss/*.scss', ['sass']);
    gulp.watch('*.html').on('change', browserSync.reload);
});


gulp.task('sass', function () {
   return gulp.src('scss/*.scss')
        .pipe(sass())
        .pipe(gulp.dest('css'))
        .pipe(browserSync.stream());
});


gulp.task('default', ['serve']);

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