0

live-server package by npm doesn't refresh (reload) the page when I change the CSS files.

It detects the changes for CSS files (in terminal) but doesn't refresh (in page).
vs code - terminal

PS E:\File\004> npx live-server
Serving "E:\File\004" at http://127.0.0.1:8080
Ready for changes
GET /favicon.ico 404 3.931 ms - 150
CSS change detected E:\File\004\style.css
CSS change detected E:\File\004\style.css

Other files are ok.
When I change other files, CSS files get update with them too. lol

I installed it locally and globally and it's still the same.
Is it because of package.json file or what?

{
  "dependencies": {
    "live-server": "^1.2.2"
  }
}

Thanks for helping.

Abolfazl
  • 3
  • 2
  • Did you try to use another browser? Which one are you using. Live Server is working fine and the package.json has nothing to do with it. It's a file listing the packages you are using – SickerDude43 Jul 21 '23 at 12:13
  • Thank you @SickerDude43 it works on other browsers. But it would be better if I could use it on Chrome. – Abolfazl Jul 21 '23 at 12:22

1 Answers1

0

LiveServer works by tricking your browser into injecting changes in CSS files. If that doesn't work you may have a browser problem.

If you want live-server to reload the page on changes use this parameter when running live-server

npx live-server --no-css-inject

You can find more information here.

https://www.npmjs.com/package/live-server

SickerDude43
  • 168
  • 8