Using lessc on Windows

13.4k views Asked by At

I've been trying to work out how to install lesscss.org on Windows 7 so I can use it from a cygwin command line interface and also using Maven.

We have SASS running in this way but there is a requirement to use LESS in a new project.

My Steps so far...

  1. Checked Ruby is installed, I have it installed at C:\Ruby193
  2. Downloaded the Ruby DevKit and followed this to install it.
  3. At CMD.exe, execute gem install less - 1 gem installed ... less-2.2.1
  4. CMD.exe, run lessc - This gives [WARNING] Please install gem 'therubyracer' to use Less.
  5. So at CMD.exe I try gem install therubyracer which gives this error...

ERROR:

Error installing therubyracer: ERROR: Failed to build gem native extension.

Full error is here


6. And this is where I'm stuck because lessc is still complaining therubyracer is not installed. I've also installed Python27 and added it to the Path variable as that came up in a previous error.

I can confirm I have this path C:\Ruby193\lib\ruby\gems\1.9.1\gems\therubyracer-0.10.1 which looks like a project to me but something is obviously wrong.

I've also found this as a potential answer to getting LESS on Windows but that would indicate we can't get the native 'real' version to run so both Macs, Windows and Ubuntu can use the same switches/ environment? github.com/duncansmart/less.js-windows

2

There are 2 answers

1
Justin Beckwith On

As the others mentioned, this is now easily done with node:

npm install -g less

This will install less as a global module that you can use from anywhere on the command line by typing:

lessc input-file.less output-file.css

An even easer way to do this is to just use a tool like SimpleLess that will automagically compile and minify your LESS for you:

http://wearekiss.com/simpless

Happy Coding!

0
amklose On

Perhaps you had the same problem I did where you successfully installed the node module via:

npm install -g less

but when trying to run lessc, you were getting the error:

[WARNING] Please install gem 'therubyracer' to use Less.

I think this is because, though you've installed the node module, the lessc command is still tied to the ruby gem. Try uninstalling the less gem:

gem uninstall less

And then try running lessc again.