How to use LESS on Ubuntu 14.04 LTS
Here is how I got Less CSS to work on my web server, which runs Ubuntu.
The story so far:
I have redesigned my site using Less to process the CSS.
Processing CSS with Less requires
npmand it requires the
nodepackage that comes with Ubuntu 14.04 LTS installs the
nodeexecutable with the name
nodejs, which prevents programs installed with
A new hope
The new chapter begins with NVM, the Node version manager (via Justin Ellingwood). This looks to be Node’s answer to RVM and Python’s Virtualenv. As with Virtualenv, it is installed not as system administrator but as the individual user. On my server each site has its own user account, so I do something like this:
$ ssh email@example.com ... $ curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.25.4/install.sh | bash $ nvm ls-remote $ nvm install v0.12.7 $ nvm alias default v0.12.7
Now we can install Less in the usual way:
$ npm install -g less less-plugin-clean-css
Entropy strikes back
Alas! it turns out that despite my best hopes this does not quite work for
deploying via Fabric because the changes to include
nvm are in
which does not run for non-interactive shells.
Instead the code in
fabfile.py must be changed to something like this:
with cd(code_dir): run('. ~/.nvm/nvm.sh && make')
This will activate the default Node installation before running Make.