› ~/

WSL2 Livereload

2020-08-09 [updated 2021-05-23]

I’m a very happy user of WSL2, it’s blazing fast and allows me to fiddle with projects that I otherwise would have issues with running on my Windows machine. I’m also a user of hugo, to create static homepages.

I was trying to figure out how to use sass and to pre-process those files into css using hugo’s built in pipes. I was scratching my head and cursing for a good while, trying to understand why the pipes where not working. Turns out that it wasn’t anything wrong with the pipes, it was the environment where I ran hugo.. 🤦‍♂️

Setup

Problem

Changing a file on the Windows filesystem does not trigger a notification that a file has changed to WSL2, this means that livereload will not work in hugo since no change has been detected.

Solutions

Further reading

People have been writing quite extensivly regarding this, but it seems to be a feature and not a bug according to Microsoft.

https://github.com/microsoft/WSL/issues/4739

Update

I decided to retire my old WSL1 setup, and by doing so it forced my to embrace the filesystem of WSL2. It’s working out for me, even though I was a bit skeptical about putting the project on the WSL2 mount.

Written by
Andreas