Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Local server not reflecting updated files

I'm fairly new at user local servers. I'm using the http-server which is a package from Node. I'm using it to host an HTML5 game using the Phaser library. I have image assets I'm using in the game, and I sometimes update these assets. When I do, the changes to the images aren't reflected in the game. I've tried restarting the server but that doesn't help. It usually takes some time for them to update, maybe about an hour. Any ideas what's going wrong?

like image 218
Jake Moritz Avatar asked Mar 17 '15 17:03

Jake Moritz


2 Answers

The browser might be caching your code and/or assets.

In Chrome, with dev tools open (Right click -> Inspect element) you can right click on the refresh button and 'empty cache and hard reload'.

like image 61
tonyedwardspz Avatar answered Oct 23 '22 07:10

tonyedwardspz


There's an option -c that refers to the cache time (max-age) in seconds [3600]

(e.g. -c10 for 10 seconds).

To disable caching, use http-server -c-1

You can see more information by enter http-server -h (for help)

like image 18
Lucas Lopes Avatar answered Oct 23 '22 07:10

Lucas Lopes