我有一个正在构建的webapp,因此它有几个错误。但是有两个错误我没想到,他们正在避免从BrowserSync自动刷新。
这是我配置了BrowserSync的gulpfile.js:
var gulp = require('gulp');
var uglify = require('gulp-uglify');
var concat = require('gulp-concat');
var clean = require('gulp-clean');
var estream = require('event-stream');
var sass = require('gulp-sass');
var browserSync = require('browser-sync');
var runSequence = require('run-sequence');
gulp.task("default", function () {
browserSync({
server: {
baseDir: '.'
}
});
gulp.watch('./app/assets/scss/*.scss', ['watch-sass']);
gulp.watch('./app/**/*.js', browserSync.reload);
});
gulp.task('build', ['clean'], function () {
console.log("Building...");
runSequence(['compile-sass']);
});
gulp.task('clean', function () {
return gulp.src('./app/assets/scss/compiled', {read: false})
.pipe(clean());
});
gulp.task('compile-sass', function () {
return gulp.src('./app/assets/scss/**/*.scss')
.pipe(sass().on('error', sass.logError))
.pipe(gulp.dest('./app/assets/scss/compiled'));
});
gulp.task('watch-sass', ['compile-sass'], browserSync.reload);
这是第一次加载页面时出现的错误:
我错过了什么?
谢谢!