How to stop the preview server
-
20-12-2019 - |
Question
This code is based on wintersmith static site generator
In my code I'm starting the preview server like this:
env.preview(function(error, server) {
if (error) throw error;
console.log('Server running!');
setTimeout(function(){
console.log("going to shut it down")
server.stop();
}, 3000)
});
This is taken from the example. I would expect the preview server to stop after 3 seconds, but instead I get an error, that server is undefined.
I looked a bit closer at it and indeed: server is undefined. Anything I'm doing wrong? How am I able to stop the preview server?
Solution
This looks like a bug, create an issue on github and i'll have a look at it when i get some time.
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow