Enabling Hot Reload in a Jekyll Container on Windows

2023/06/18
146 words
1 min

Problem

Some time ago, I decided to give Windows a try as my host, my main development environment. I truly appreciate the improvements made by Microsoft for developers. However, there are still some portability caveats that need to be addressed.

This blog is built with Jekyll and hosted on GitHub Pages. I have a habit of testing everything before pushing it anywhere and I love to see results as quickly as possible. Therefore, having hot reload functionality is a must-have for me. Unfortunately, when I tried using my previous Dockerfile with jekyll serve --watch on Windows, it didn't work as expected.

Few minutes and bunch of documentation pages later, I managed to get it working by adding a few more parameters.

Solution

I made the following switch in my Dockerfile:

From:

dockerfile
CMD ["jekyll", "serve", "--watch"]

To:

dockerfile
CMD ["jekyll", "serve", "--watch", "--force_polling", "--livereload"]

This simple modification did the trick and saved me from switching back to Linux.

Last modified:


For commercial reprinting, please contact the webmaster for authorization, for non-commercial reprinting, please indicate the source of this article and the link to the article, you are free to copy and distribute the work in any media and in any form, and you can also modify and create, but the same license agreement must be used when distributing derivative works. This article is licensed under the CC BY-NC-SA 4.0 license.