antonio
antonio

Reputation: 1

BrowserSync Not Reloading Changes

I started BrowserSync with this command:

browser-sync start --proxy localhost:8001 --files "app/css/*.css"

I have the code snippet in index.html and when I open the page in my browser, I see the message:

Connected to BrowserSync

But when I make changes to the CSS, the BrowserSync does not reload the page with the changes. I have to manually reload to see the change.

Upvotes: 0

Views: 1217

Answers (1)

Subin Sebastian
Subin Sebastian

Reputation: 31

  1. It is --files="app/css/*.css" and not --files "app/css/*.css"

  2. Browsersync reads index.html by default, hence you get the message 'Connected to browsersync'

And here's the solution to your answer..

In every forum I have checked, everyone is following the same nomenclature of "css/*.css". Without realizing what the initial css stands for. Its the name of the folder or directory not something for vague..

Hence, make sure that inside those quotes you have pointed to the right directory. For example, if the styles.css file is just outside (i.e. in the root directory) alongside index.html, then just write --files="styles.css". It shall work like charm.

And if you want Browsersync to watch multiple css files then put --files="*.css". If you want to sync different types of files, then use --files="*.html,*.js".

If these css files are in some directory say 'xfolder' then --files="xfolder/*.css"

Upvotes: 3

Related Questions