Answer the question
In order to leave comments, you need to log in
Does not work in Gulp browserSync, in the terminal it gives Task never defined: browserSync, what should I do?
Installed Gulp (v.4.0.2), but when run in the terminal, it gives an error Task never defined: browserSync (2.7.5) and does NOT display a blank page in the browser (as it should).
Code in gulpfile.js:
const {src, dest, watch,} = 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: "#src/"
}
});
}
function styles(){
return src('#src/scss/style.scss')
.pipe(scss({outputStyle:'compressed'}))
.pipe(concat('style.min.css'))
.pipe(dest('#src/css'))
.pipe(browserSync.stream())
}
function watching(){
watch(['#src/scss/**/*.scss'], styles);
watch(['#src/*.html']).on('change', browserSync.reload);
}
exports.styles = styles;
exports.watching = watching;
exports.browserSync = browserSync;
PS C:\Users\user\Desktop\fls-gulp> gulp browserSync
20:03:04] Using gulpfile ~\Desktop\fls-gulp\gulpfile.js
[20:03:04] Task never defined: browserSync
[20:03:04] To list available tasks, try running: gulp --tasks
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question