There are a variety of languages and compilers for LESS, but I prefer the simplicity of LESSC on Node. It’s easy to install and more current than the LESS gem for Rails.

Installing is easy, simply follow the below steps and you’ll be running in no time.

First we need Node:

 sudo apt-get update
 sudo apt-get install git-core curl build-essential openssl libssl-dev
 git clone https://github.com/joyent/node.git
 cd node
 ./configure
 make
 sudo make install
 node -v
Now let’s get NPM (which we’ll use to install LESS)
 curl http://npmjs.org/install.sh | sudo sh
 npm -v

And now LESS

 npm install less

Finally, we’ll need to update our PATH to LESS

 gedit ~/.bashrc

and add the line

 PATH=$PATH:$HOME/node_modules/less/bin

now save your bash file and reload

 source ~/.bashrc

And that’s it. You should now be able to invoke LESS from the terminal window like so:

 lessc LESSFILE.less > CSSFILE.css

(if you receive an error running LESSC you will need to correct the path to LESS. Locate the less/bin directory inside your node modules folder, and replace the path relative to the home directory eg (PATH=$PATH:$HOME/your/node/modules/less/bin) in bash.rc and reload)

Leave a Reply

Your email address will not be published. Required fields are marked *