33

Trying to set up LESS for CSS on my Windows box, I've installed ruby and rubygems and followed the instructions exactly.

I have put teststyle.less in C:\.
When I type

lessc teststyle.less

to compile it into a .css file, I get an error:

The filename, directory name, or volume label syntax is incorrect.

Out of those familiar with LESS, do any of you have a solution to my problem?
Did I mess up the install?

Community
  • 1
  • 1
Mojave Storm
  • 571
  • 2
  • 7
  • 18
  • 1
    Here are four nice **out of the box** solutions for Windows: - http://wearekiss.com/simpless - http://winless.org/ - http://koala-app.com/ - http://alphapixels.com/prepros/ – Bijan Feb 06 '12 at 09:39

9 Answers9

22

If you don't want to use GUI to compile LESS on Windows, there is a clean way to get lessc command on Windows command line. It only requires you to install node.js, which is required by original lessc anyway.

So, install node.js (http://nodejs.org/) and install "less" module for node.js. The latter provides lessc executable (lessc.cmd on Windows) as well, so you should only make sure it gets under your PATH in Windows.

If you don't have node.js yet, here are step-by-step instructions:

  • Install node.js (http://nodejs.org/)
  • In new command-line, go to node.js installation directory (where node.exe is located), and execute > npm install less (make sure you do so from node.js installation directory only)
  • Latter downloads less module for node.js, as well as lessc.cmd to node_modules/.bin/ directory. Add this directory to PATH
  • Now, in new command line you may enjoy the use of lessc as usual

Source: http://pragmatictim.blogspot.fr/2012/08/developing-with-less-on-windows-getting.html

Tim
  • 12,318
  • 7
  • 50
  • 72
17

You should look at http://www.dotlesscss.org/, less ported to C# and specifically designed for .NET. You can use either a handler or compile.

Been using it for about six months, it's great.

Oops...saw windows and assumed dot net, perhaps that's not your environment. If not, never mind...

Cody Gray - on strike
  • 239,200
  • 50
  • 490
  • 574
Rob
  • 5,525
  • 1
  • 24
  • 26
  • 5
    Just so you're aware the ruby implementation is no longer under active development. It is being replaced by http://github.com/cloudhead/less.js which runs under node.js. as Rob points out, dotless is a great way to compile your .less files on windows without requiring you to install ruby. – tgmdbm Jun 07 '10 at 04:34
  • dotLess compilation of Bootstrap 2.1 fails due to lack of (or incomplete?) support of less arguments. See https://github.com/twitter/bootstrap/issues/4976 – Pat James Sep 05 '12 at 16:36
  • 1
    I know this is very old, but I had issues with dotless to the point of converting off of it. The main reason being that we were getting lots of compilation issues and trying to mix dotLess and Less in a framework like BootStrap was getting messy. – James M Mar 19 '13 at 18:55
10

Edit:

lessc does work on Windows now. See the Github page about commandline LESS tools for installation and usage instructions. The Github page with a list of LESS GUI tools might also be interesting.

Original answer:

The lessc command line tool for less.js doesn't work on Windows. If you want command line compiling of your LESS files you should check out this post.

Also be sure to check out WinLess. WinLess is a compiler (with GUI) for LESS. WinLess can watch your LESS files, and automatically compile them when they have changed. If you are using Visual Studio for your projects you should also check out the BuildEventScript of winless.org.

Be sure to check which compiler is being used when you are using different programs to compile your LESS code. If you are using programs which use different compilers you should watch out for interoperability issues (LESS code working correctly with one compiler, but not with another).

Mark Lagendijk
  • 6,247
  • 2
  • 36
  • 24
  • 2
    FWIW, less.js DOES work fine on Windows (now). Perhaps it didn't when you posted this, but as of now it works. Install node, run `npm install less` and type `lessc foo.less foo.css`. Works great. – tig Jun 22 '12 at 00:32
  • I just compiled as well and it seems to work (installing through npm on windows). – David Faivre Nov 07 '12 at 19:52
  • @tig, David Faivre: you are right, it indeed does work now. Don't remember what the problem was before, but have updated the Github page to reflect this change. – Mark Lagendijk Nov 24 '12 at 21:10
4

FYI, I found this Windows command line tool to compile LESS into CSS useful. It uses less.js to do the compilation. The command syntax is not very graceful, but it works well.

https://github.com/duncansmart/less.js-windows

thaddeusmt
  • 15,410
  • 9
  • 67
  • 67
  • ..as a matter of fact, it is a wrapper around the "nodejs+source" less compiler, with a clever trick to flatten the too-deep "node_modules" dependencies, to avoid a windows problem when exceeding a limit on the maximum path length.. – Luke May 17 '16 at 15:50
3

I just started using Crunch to compile Bootstrap and its pretty awesome. Its built on Adobe Air, which you will have to install if you don't already have it.

Jeremy D
  • 1,265
  • 9
  • 5
2

I think I found the problem. In my first installation I installed to C:\Program Files\Ruby so I uninstalled and tried the default 'C:\Ruby' install path. Seems to fix the problem and it now works correctly. Thanks.

Mojave Storm
  • 571
  • 2
  • 7
  • 18
1

Only this https://github.com/leafo/lessphp PHP compiler didn't crashed with my crazy project structure with CSS imports in LESS, etc.

Very simple shell command for compiling LESS to CSS:

plessc input.less > output.css
Dmytro
  • 5,443
  • 2
  • 52
  • 50
1

You can use Prepros App for windows. It can compile less, sass, jade, stylus, markdown, coffeescript and haml with live browser refresh.

1

I have a recompiled version of DotlessCss that can accept less code from standard input and output the css code to the standard output. I have attached it at the following link LESS CSS Compiler for Windows

digitalPBK
  • 2,859
  • 25
  • 26