Using Foundation for Emails in Windows Subsystem for Linux with NVM
Foundation for Emails was a revelation when it first came out. It uses NPM to help you build responsive emails that look mostly the same in various email clients. It inlines and compresses your HTML so you can pop it into Listrak and be done.
I use it at work all the time, but getting it to npm install
is getting harder and harder. Zurb hasn't maintained it in a long time, which is a disappointment to many.
I recently spent some time troubleshooting this on a Windows machine with Ubuntu installed via WSL, and I'd like to share how I got it working.
Install NVM and Node
First, you'll want to install the Node Version Manager script. This allows you to switch between versions of Node easily. You'll need this to use Foundation for Emails, since it will throw errors with newer versions.
$ wget -qO- https://raw.githubusercontent.com/creationix/nvm/v0.33.11/install.sh | bash
Now type logout
and then bash
again to open a new terminal with the script running.
Next, you'll need to install the LTS version of Node.
$ nvm install --lts
$ nvm use --lts
This will, as of this writing, install 8.11.2.
Install Dependencies
Foundation for Emails relies on packages with some weird dependencies. I haven't been able to get it to npm install
on Windows in over a year. Their support forum appears abandoned (i.e. "community run").
In Ubuntu, you'll need to install Python 2 and G++ tools. )
$ sudo apt install python-minimal
$ sudo apt install make
$ sudo apt install g++
The build
script also uses PhantomJS, which requires libfontconfig:
$ sudo apt install libfontconfig
Installing Foundation for Emails
The rest is straight-forward if you're used to NPM. This install takes quite a while, unfortunately, but if you did everything above it should indeed build.
$ git clone https://github.com/zurb/foundation-emails-template
$ cd foundation-emails-template
$ npm install
Now you're just an npm start
away from building more boring transactional emails!
Final Thoughts
- Unfortunately, Foundation for Emails seems to have been abandoned by Zurb. Still, there isn't a much better option out there other than memorizing every quirk listed at Campaign Monitor.
Comments