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.

Recently I found out about an OS X application called LESS.app. It’s basically an app to compile and minify *.less files into *.css files and does it in real-time. I want to know or I can archive the same thing in Ubuntu and how to go about it.

share|improve this question

6 Answers 6

up vote 22 down vote accepted

Bryan here. Developer of Less.app.

I highly recommend AGAINST using the older version of LESS (the Ruby-based one). Less.js isn't just a javascript port of LESS, it's a ground-up rewrite that improves a ton of stuff, adds support for things that the old Ruby version doesn't have, and increases compiler speed by about 84%.

Rather than install the Ruby gem, install Node.js and run Less.js through Node from the command line. You'll still have all the -watch functionality, but you'll be using Less.js to do it, which means your life will be much better.

Alternately, use Less.js as a script in the website you're creating. This will work for development. When you're done coding, simply copy the CSS that Less.js generates (from your browser's inspector) and place that into a file, add a .css extension, then remove the Less.js script tag from the HTML pages and substitute the CSS file you just created.

Either way, use Less.js.

share|improve this answer
    
Thanks Bryan, I was not aware of a Less.js compiler other than the one that has to be injected in the page –I suppose a port of Less.app for Ubuntu is out of the question. ;) –  Mood Feb 1 '11 at 21:03
    
    
Does less.js work on headless build machines? I'm getting a "ReferenceError: window is not defined" when I try to run it. –  Kathy Van Stone Jun 27 '11 at 16:03
    
Note that the ruby version of less now runs off of less.js –  Kathy Van Stone Jun 27 '11 at 19:02

Note

Read Bryan's answer. He knows what he's talking about. ;-)

You can just install less.

  1. Install rubygems and less

    sudo apt-get install rubygems
    sudo gem install less
    
  2. The official documentation remarks:

    To make gem work properly you should write gem's path to PATH add to ~/.bashrc:

     export PATH=/var/lib/gems/1.8/bin:$PATH
    
  3. You can then use the less compiler by doing

    lessc style.less
    

I don't think there's a GUI like the one you've linked to. But since it only seems to be a very shallow gui on top of the real less compiler, I don't think you'll have any problems using it directly. Type

lessc --help

to learn how to use it.

If you want your .less files to be automatically compiled every time you change them, you can use the -w option:

~$ lessc test.less -w
* Watching for changes in test.less... Ctrl-C to abort.
: Change detected... * Updated test.css
: Change detected... * Updated test.css

You can put this process in the background by pressing Ctrl+Z and typing bg, and start as many as you like. You can bring them back to the foreground by doing fg, or fg 3 for the third process, to get a list of all of the jobs and their numbers type jobs.

share|improve this answer
    
Thank you! Right now I use Less.js (bit.ly/9bG1E9) but I’ll give the ruby compiler a try. The GUI isn’t important to me. But what I really like to have is a tool that watch my .less file(s) and compile a .css every time I save changes to my .less file. How it is done, through an app, CLI or an gedit plug-in doesn’t matter to me much. –  Mood Jan 18 '11 at 23:23
    
@Mood, it does that - I'll add it to the answer. –  Stefano Palazzo Jan 18 '11 at 23:50
1  
Wow! Thanks again. That’s exactly what I'm looking for. –  Mood Jan 19 '11 at 0:32

To my knowledge, ruby less isn't updated enough to even handle the concatenation operator.

For those interested in a solution that compiles .less upon save for non mac platforms using less.js, you can check out this installation guide*. Though the tutorial is geared towards Windows users, I imagine if you can get Node.js on your system, the script itself will function the same.

*Disclaimer: This tutorial is mine. Just thought people might want to see specifically what the poster above meant by "Use Node.js". I wasn't able to find any scripts online for using Node.js to compile LESS upon file save, so I cooked one up and thought I would share it.

share|improve this answer
    
It's great to have your participation, but this looks odd -- advertising a post on your own site for a Windows solution? Does this add something that the other answers don't? –  belacq Apr 2 '11 at 5:06
    
Yes - non ruby, non MacOSX. You can use the less.js script that works with node.js, so non MacOSX users that can get Node.js compiled can enjoy instant .less compilation. –  user13446 Apr 2 '11 at 5:38
    
Thanks. –  belacq Apr 2 '11 at 5:44
    
Getting Node.js running is not hard. Not sure or I followed this article codediesel.com/linux/installing-node-js-on-ubuntu-10-04 but Node.js was set up in no time. Setting up Less.js however had me pulling out some hairs. I figure once you have Node.js running on Ubuntu you can follow the steps in Joseph’s tutorial to get less.js up and running and thus this is a helpful addition to this thread. –  Mood Apr 8 '11 at 14:43

Under Ubuntu 11.10, you can simply issue a

sudo apt-get install lessc
share|improve this answer

you can install it the command line compiler in Ubuntu 12.10 as well:

sudo apt-get install node-less
share|improve this answer

There's also http://koala-app.com/.

http://crunchapp.net/ was my favorite, but we have to thank Adobe for discontinuing AIR for Linux.

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.