I, like (I assume) many of RPi tinkerers and hackers, make code changes on my desktop or laptop and then use git to push new code to the RPi. Since MagicMirror doesn’t track css/custom.css, the mirror fails to load up if the file is missing.
I tried to come up with a PR to have the loader.js file check if the file exists before appending it to index.html. However, since this is client side JavaScript, it does not have access to the file system and can’t use the fs JavaScript module.
I then tried to use code like:
var fileDoesNotExist= function(url) {
var http = new XMLHttpRequest();
http.open("HEAD", url, false);
http.send();
return http.status==404;
}
to do an http request to the server for the file, but realized that it’s just as bad as the actual http request that tries to load the file and will result in the same errors.
So, I’m posting this here in case anyone has ideas and can help me with creating a PR to solve this problem. It’s not really a bug and not really a feature. Just an error check that’s missing.
Thanks.