Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

npm live-server doesn't refresh the page

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

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

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.

>Solution :

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

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading