You know what’s cool? Web dev in WSL 2 using Visual Studio Code!
So, my blog was broken for ages. It doesn’t take much cyber-snooping to discover that - it’s right there in my blog history; a period of silence, a blip, followed by deafening nothing.
As it turns out, moving cities, my wife and I changing jobs, and having twins all at the same time is quite difficult!
I’m out the other side, though.
So: I needed to get my blog running locally again. Well, I didn’t really need to, as Github pages + Jekyll is pretty easy; I could have kept pushing new markdown blog posts via git, and all would have been well. But what’s the fun in that?
What’s a better excuse to check out WSL 2 than trying to get my dev blog building locally agin? That’s right, there is none. None more better.
The coolest thing, though (which you’ve no doubt gleaned from my blog post title) has been discovering I could dev in Ubuntu using my local Visual Studio Code running in Windows, working against the local dir in WSL 2 Ubuntu.
Getting Windows Linux Subsystem Up and Running
If you don’t have WSL running on your Windows 10 box, start here:
Windows Subsystem for Linux Installation Guide for Windows 10
It’ll take you through all the steps necessary to getting WSL2 up and running.
Install the Visual Studio Code Remote - WSL Extension
Install this extension either by clicking install here: Visual Studio Code Remote - WSL Extension
Or, just find it in the Visual Studio Code extensions tab
Connect Your WSL Distro to Visual Studio Code
Here’s the easy part - once you have WSL2 running and you’re logged into your local Linux distro of choice (Ubuntu 20.04 LTS for me), all you have to do is type:
code .
and you’re off and running!
WSL and Visual Studio Code: a Match Made in Heaven
I’m in love.
I can have the best of both worlds with WSL2 and VS Code - I can do all my web coding in a Linux environment all wrapped in my comfortable Windows world.
For more information, check out these great posts that I referenced:
Tips and Tricks for Linus Development with WSL and Visual Studio Code