Closed Kristinita closed 8 months ago
Status: RESOLVED :heavy_check_mark:
Don’t use watch: true
if the option files
already exists.
module.exports = {
files: [
+ "**/*.html"
- "**/*.html",
- "!**/*.yaml"
],
logLevel: "debug",
open: false,
- watch: true
};
Browsersync already watches files defined in the files
option without the watch
option. If user additionally adds watch: true
, Browsersync reload tabs in browser, when Browsersync user saves any project file. watch
“should be used as an alternative to the files
option”.
Thanks.
#1380 — possibly related 2017 issue.
1. Summary
If I use glob patterns in the value of the
files
option, Browsersync reloads browser tabs when I save files that isn’t matches by my glob patterns. For example, if I use the pattern**/*{html, js}
, Browsersync not solely reloads browser tabs when I save.html
and.js
files, but also when I save files with any other extensions.It looks like a bug. If this isn’t a bug, it would be nice to add to the documentation how to use glob patterns in Browsersync. After reading the documentation, in particular documentation of the options
files
andwatchOptions
, I didn’t understand what I should do.2. MCVE
2.1. bs-config.js
2.2. Project structure
KiraHTML.html
,KiraXML.xml
andKiraYAML.yaml
may contain any valid content or no content.2.3. Steps
2.4. Behavior
2.4.1. Expected
See the expected glob pattern matches for my MCVE case online on Globster:
I expected that Browsersync would solely trigger a browser tab reload event when saving a file
KiraHTML.html
, that matched my glob pattern.2.4.2. Actual
The browser tabs reload event is triggered, despite that glob pattern
**/*.html
doesn’t match.xml
files.3. Environment
Thanks.