Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

From my understanding and correct me if I'm wrong, I have to get ruby or NPM installed to get the less css compiler working.

I don't have any ruby installed and I'm not really sure how to get my computer to that point. I also want to minimize my footprint; installing the minimal amount of ruby libraries if possible (because i will never use ruby except for when i run less).

What are the steps involved in getting less working and running?

Before you down vote, I know there was this previous thread (Less CCS compiler install).

This particular person already has some other packages installed. I'm trying to figure out all the packages needed to get to that point.

Or if someone could point me to the right documentation I would be thrilled!

share|improve this question
    
Also discovered this app: code.krml.fr/less.app it requires installing inotify-tools –  chrisjlee Dec 4 '12 at 15:42

5 Answers 5

up vote 32 down vote accepted

I'm not entirely sure if by compiler you want something that will automatically compile your less files on the fly or on the server. Because otherwise you can

$ sudo apt-get install node-less yui-compressor

(On Ubuntu 12.04, the node-less package is called node-less.)

and then,

$ lessc example.less > compiled_example.css
$ yui-compressor -o small_and_compiled_example.css compiled_example.css
share|improve this answer
    
thanks this works in Ubuntu 13.04 too :) first day with LESS –  STEEL Sep 25 '13 at 9:50

Most simple way is to install nodejs with its package manager npm. Nodejs is in the repositories, but that one is a bit outdated, instead you could use this ppa:

sudo apt-add-repository ppa:chris-lea/node.js
sudo apt-get update
sudo apt-get install nodejs

( https://github.com/joyent/node/wiki/Installing-Node.js-via-package-manager ) Especially if you're doing JavaScript/Web development nodejs is pretty important today.

At this point it's simply (as stated on http://lesscss.org)

npm install -g less

Probably, because you install globally (for the command), you need to prepend this comment with sudo.

share|improve this answer
1  
Unfortunately, the version of Nodejs which is available through the Ubuntu repositories is incompatible with the version of LessCSS which you get with npm install -g less (at least as of July 2013). –  Alex D Jul 23 '13 at 7:52
    
I think that the nodejs package now contains the npm command so you don't need to (it caused an error for me) install it separately. –  Felipe Almeida Nov 3 '13 at 3:37

First of all, there are a few things that need to be said:

  • Ruby on Debian (and therefore by extension, Ubuntu) has a horrible setup with ruby.

  • As such, the "recommended" solution is to compile and install your own version of ruby - this is made fairly painless with railsready.

wget --no-check-certificate https://raw.github.com/joshfng/railsready/master/railsready.sh && bash railsready.sh

What that script will do for you is download ruby, compile it and then install it for you. After that, you need to run exec $SHELL, and then you can install less with with gem install less (no need for sudo)

share|improve this answer
1  
I've checked the less.js repository - it is 100% javascript, why do I need rails to install it? –  Evgeny Apr 18 '12 at 22:16
    
@Evgeny At the time I wrote this, it was still recommended that you use the ruby version of less.js. I'll update my answer with the new, "proper" instructions shortly. –  jrg Apr 18 '12 at 22:21
    
thanks, installed it with npm. –  Evgeny Apr 18 '12 at 22:58

On Ubuntu 12.04, the LessCSS version in the repository is 1.2.2. To get LessCSS 1.3.3, you could use Node Package Manager :

sudo apt-get install npm

and then

npm install less

After that you'll have to change your PATH or use full path to the less compiler:

~/node_modules/less/bin/lessc
share|improve this answer
    
Change my PATH? –  Jeromy French Mar 27 '13 at 2:42

There is also a python-lesscpy compiler, but it doesn't work for Bootstrap 3 at least.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.