newfangledjstoolschains: Part I
I stumbled upon semantic-ui whilst surfing, and immediately became intrigued. It made sense, and it looked great! I had to try it for my new static blog!
Sure, I could just generate the source for the widgets and css I wanted from
their docs, and hand-copied it into my various static
folders, but
instead, I wanted to attempt to employ the power of build. It has been a long
while, but I'm slowly remembering how to wield themtharnewfangledjstoolschains,
aka Gulp, and bower, and npm.
Gulp and bower in particular are quite useful. Bower is like pip
install
for javascript-y libraries. But before using bower, we gotta
install node. If there is one thing that I know I love, it is installing random
javascript code from the internet onto my machine globally. Everytime I see
things like this in a README file, I get very very sad:
$ sudo npm install -g totally_legit_js_library
$ sudo pip install totally_legit_python_library
Please, don't sudo install the things, and certainly not globally, without taking a moment to think if that is desirable or necessary. Don't get me wrong, I sure don't grok all the way to the bottom of every stack I deploy, but this is exactly why I try not to give any-ole stack the ability to run as root.
On top of that, I've been taught you should *almost* always use a virtualenv, or other safe and somewhat isolated micro-universe far away from your system packages.
There are a number of solutions, but my favorite one thusfar has been
installing into a python virtualenv! One time at a hackathon, I blindly trusted
a teamate who encouraged me to just curl
and ./
some
shell script off of a website somewhere to get nvm
set up, which I
begrudgingly did, but have since discontinued the practice of. Here is what
I've been doing instead:
https://lincolnloop.com/blog/installing-nodejs-and-npm-python-virtualenv/
Yes, it takes longer, but there is something so satisfying about building from
source. I found that after I got node installed, I could npm install -g
all-the-things
that I needed, and those would be conveniently located within
a python virtualenv that I'd likely be using to server up the static content
anways.
So far, so good! I've got a working js toolchain, with my desired deps installed! You can find the initial commits here: https://github.com/decause/cardsite
Part II Goals
Get node and npm install on my local machine without requiring rootGet a workingbower.json
package to install the thingsGet a workinggulpfile.js
package to move the installed things- Get a working
nikola deploy
workflow to run the gulpfile in addition to building the site! - Incorporate semantic-ui cards into
fedmsg
feed, and possibly other aspects of site.
Stay tuned for Part II!