Comments (7)
what I found is you have to play with it until you find what works...path wise. like:
./
/
./folder/
etc. until it says its watching files, and make it a file where you know how many files to be watched so you can verify.
my 2 cents.
from browser-sync.
It says "Watching 2 files"... but if i change any file, it does not recognize the change.
I am in the folder my_project/static/, which contains two files: rte.css and project.css
When I run browser-sync --files "../static/*.css"
I get the output with the script blocks and the info "Watching 2 files".
If I change any of the css files, nothing happens in this terminal window.
If I run browser-sync --files "*.css"
, I get the same output as with the other command.
But now, changes are detected:
File Changed: rte.css
Injecting file into all connected browsers...
from browser-sync.
Hmmm. if you are in my_project/static
I would try browser-sync --files "./static/*.css"
Im about to do an issue on a similar "no updates" happening.
from browser-sync.
also I try adding a new file to see if it increases the amount watched to insure its watching the same directory.
from browser-sync.
@rvock - not exactly sure why you'd want to run this
browser-sync --files "../static/*.css"
Why not cd back a directory and just run
browser-sync --files "static/*.css"
?
from browser-sync.
browser-sync --files "../static/*.css"
was a simplified test case which shows the bug.
My real setup locks a bit different:
I use grunt and grunt-browser-sync and my folder structure looks more like this:
|
+ build
| + node_modules
| | [...]
| + Gruntfile.js
|
+ release
+ index.html
+ static
+ style.css
The gruntfile has the following config for browser-sync:
browser_sync: {
files: {
src : '../release/static/*.css'
}
}
Running grunt browser_sync
will say that it's watching one file, but changes are not detected. The same happens, if I do not use grunt, but cd into the build directory and run browser-sync --files "../release/static/*.css"
This means it's not a bug in grunt-browser-sync, that's why I reported the issue here.
There are two workarounds:
- move the Gruntfile to the project-root and modify all paths in the gruntfile
- Use
grunt.file.setBase('..');
in the Gruntfile.js and modify all paths.
But best solution would be a fix :)
After taking a look at the code, I am not sure, if it's maybe a bug with chokidar, because the files option is passed to it:
var watcher = chokidar.watch(files, {ignored: /^\./, persistent: true});
from browser-sync.
Thanks!
from browser-sync.
Related Issues (20)
- browser-sync crashes sometimes with
- Close Browsers When Browser-Sync stops HOT 1
- How to exclude multiple path patterns at the command line
- Browsersync client script not injected when proxying through Cloudflare Zero Trust HOT 2
- Security vulnerability with `qs` dependency HOT 3
- Uncaught TypeError: D is not a function in browser-sync-client.js?v=2.27.11:11:100416
- Browser-sync will not connect to proxy
- Script tag is injected in the wrong place (in the middle of body's attribute list) HOT 1
- Dependency on specific version of ua-parser-js prevents vulnerabilities in downstream projects from being fixed HOT 7
- Browser Sync does not load - white screen with Webpack / Wordpress HOT 3
- Proxy mangles URL strings in JSON
- use chalk everywhere
- browser-sync tried to access chalk, but it isn't declared in its dependencies; this makes the require call ambiguous and unsound HOT 7
- Failing to update HOT 1
- Error [ERR_REQUIRE_ESM]: require() of ES Module [...]/node_modules/.pnpm/[email protected]/node_modules/chalk/source/index.js from [...]/node_modules/.pnpm/[email protected]/node_modules/browser-sync/dist/async.js not supported. HOT 3
- Release notes for 2.29.1? HOT 6
- [BUG] Breaking change in 2.29 (removed document.write) HOT 2
- Not working on node@^20.0.0 HOT 3
- Not working on OSX with Chrome HOT 3
- cant read any cookies using JS with BS Proxy
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from browser-sync.