Giter VIP home page Giter VIP logo

Comments (7)

normanlove222 avatar normanlove222 commented on June 18, 2024

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.

rvock avatar rvock commented on June 18, 2024

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.

normanlove222 avatar normanlove222 commented on June 18, 2024

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.

normanlove222 avatar normanlove222 commented on June 18, 2024

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.

shakyShane avatar shakyShane commented on June 18, 2024

@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.

rvock avatar rvock commented on June 18, 2024

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:

  1. move the Gruntfile to the project-root and modify all paths in the gruntfile
  2. 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.

shakyShane avatar shakyShane commented on June 18, 2024

Thanks!

from browser-sync.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.