【发布时间】:2017-06-30 06:24:29
【问题描述】:
我在使用 Microsoft Visual Studio 开发的 Web 应用程序中使用 gulp 浏览器同步。当我在修改文件时开始使用浏览器同步重新加载页面时,就会出现此问题。我的应用程序在我的默认 localhost 上运行。开发构建成功,但无法打开站点。以下是我的 gulp 代码:
var gulp = require('gulp');
var sass = require('gulp-sass');
var bs = require('browser-sync').create();
gulp.task('serve', [], function() {
// .init starts the server
bs.init({
server: "./",
port: 64510
});
});
gulp.task('sass', function() {
return gulp.src('scss/*.scss')
.pipe(sass())
.pipe(gulp.dest('css'))
.pipe(bs.reload({ stream: true }));
});
gulp.task('watch', ['browser-sync'], function() {
gulp.watch("scss/*.scss", ['sass']);
gulp.watch("*.html").on('change', bs.reload);
});
gulp.task('build', ['clean-code', 'serve', 'browser-sync'], function() {});
【问题讨论】:
标签: javascript gulp browser-sync gulp-watch gulp-sass