Answer the question
In order to leave comments, you need to log in
Gulp - BrowserSync says "cant get /", how to solve the problem?
I have a gulpfile that handles css and livereload:
const gulp = require('gulp'),
browserSync = require('browser-sync'),
concat = require('gulp-concat'),
cleanCSS = require('gulp-clean-css'),
del = require('del'),
autoprefixer = require('gulp-autoprefixer');
gulp.task('styles', function() {
return gulp.src('./css/*.css')
.pipe(concat('style.css'))
.pipe(autoprefixer())
.pipe(cleanCss({
level: 2
}))
.pipe(gulp.dest('./dist/css'))
});
gulp.task('clean', async function() {
return del.sync('./dist/css/*');
});
gulp.task('browser-sync', function() {
browserSync({
server: {
baseDir: './'
},
notify: false
});
});
gulp.task('watch', gulp.series('browser-sync'), function() {
gulp.watch("./css/*.css", browserSync.reload);
gulp.watch("./html/*.html", browserSync.reload);
});
gulp.task('default', gulp.series('watch'));
gulp.task('build', gulp.parallel('clean', 'styles'));
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