6 May 2016

Run build tasks inside your VM or on the host?

I build websites working on a Windows (or Mac for some clients) computer with a Linux virtual machine (spun up by Vagrant) running inside that contains the actual website files. Most web developers do something like this. But until last week I hadn't thought of running my NodeJS dev build tasks such as Grunt and Gulp in any environment other than the Linux VM itself.

Despite the fact I know NodeJS installs really easily in Windows (and Mac) and I know the big "real-world" machine will always be better resourced to run tasks than the "fake" computer that is the VM, and I know the drive is mounted for perfect reading and writing by the host machine and I know build tasks only need to be run during development and never on the production server. Despite all that -- for some reason -- I just always kept my head inside the VM when thinking about build tasks.

So now (with NodeJS installed on my Windows machine) I whip up PowerShell, navigate to the directory of the VM's mounted drive and run the 'gulp' command... Voila! Now the host machine -- with it's abundance of resources -- is doing the heavy(ish) lifting.