Browsersync只是重新加载index.html,即使我有我的基础设置,甚至文件选项上列出的特定文件.
我已查看他们的文档,但我有他们说的所有内容,仍然只刷新或同步index.hrml,但about.html例如没有.
我的结构是这样的:
-booming-gaes-web
-dist
-node_modules
-src
-index.html
-about.html
-gulpfile.js
Run Code Online (Sandbox Code Playgroud)
所以我的html文件在我的src文件夹上是直接的,并且gulp文件与src文件夹在同一个文件夹中.
我的gulp档案:
// Include gulp
var gulp = require('gulp');
// Include Plugins
var browserSync = require('browser-sync');
// Watch Files For Changes
gulp.task('watch', function() {
gulp.watch('src/js/*.js', ['js-watch']);
gulp.watch('src/css/*.scss', ['sass-watch']);
gulp.watch('src/css/*.css', ['prefix']);
gulp.watch('src/*.html').on('change', browserSync.reload);
browserSync({
files: ['src/index.html','about.html'],
server:{
baseDir:'src',
directory: true
}
});
});
Run Code Online (Sandbox Code Playgroud)
我做错了什么想法?谢谢!