Open lkraav opened 6 years ago
I confirm this happens with other file types too. Started to happen after 2.18.3.
It doesn't happen with all text/code editors though. For example with Notepad++ it doesn't happen.
I'm on Windows and I'm using browser-sync via gulp.
EDIT: Oh, and it seems, it reloads only the first time I open the file; if I close and re-open the same file, it doesn't have the bogus reload.
@XhmikosR oh, interesting. I'm on Linux + vim
.
Can you add a few details about what you're seeing: what are your specific file names causing bogus reloads?
The filenames don't seem to matter. I can't find something common. Only thing I know for sure is that it doesn't happen with all editors.
@lkraav sounds like it could be because of swap files, try something like
module.exports = {
"files": [
"wp-content/themes/*/style.css"
],
"watchOptions": {
ignoreInitial: true,
ignored: ["*.php", "**/*.swp"]
}
}
So the trick seems to be about properly globbing ignored **/*.php
, like @shakyShane suggested for *.swp
. I'm not getting reloads anymore.
It is still a mystery why ignored
has to be used, and why content.php
specifically triggers a reload. There are other .php
files in that same directory, they don't cause a reload.
I personally don't have any of those set. My config is this:
snippetOptions: {
// Provide a custom Regex for inserting the snippet.
rule: {
match: /<\/body>/i,
fn(snippet, match) {
return snippet + match;
}
}
},
server: {
baseDir: buildDir
}
@shakyShane @lkraav: it seems the issue is fixed, at least for me on Windows with 2.23.2.
@XhmikosR thanks for reporting. Any thoughts on which commit may have fixed it?
No idea which commit fixed, but it is fixed for me :)
Hmm, spoke too soon. It still happens for some file types.
Issue details
bs-config.js
only defines watching a specific set ofstyle.css
files.But for some strange reason, editing
wp-content/themes/something/content/content.php
causes browsers to reload the page. I want this to stop.No match "file change" event is listed in debug log, just says "Reloading Browsers..."
I'm confused about why this is happening. It has started happening recently, maybe in the minor updates of the last couple of months?
The only connecting piece I'm able to detect is the watcher's list also including
...content/
path as part ofwp-content/
, but no idea if this plays any part here.Steps to reproduce/test case
Description above.
Please specify which version of Browsersync, node and npm you're running
Affected platforms
Browsersync use-case
If CLI, please paste the entire command below
node_modules/.bin/browser-sync start --config bs-config.js