Less CSS Compiler for Windows (lessc.exe)

LESS CSS Compiler

LESS is a language that helps CSS Designers to write better manageable and extensible CSS style sheets.

Current less compiler called lessc is only available for the *nix platforms, which can compile LESS files to CSS.

Where is lessc.exe ?

lessc.exe for those who are in a hurry :) .
It is attached to the bottom of this post also so feel free to read on.

How to use the lessc.exe

This compiler is adapted from the .net port of less compiler called dotless Compiler, which takes in a filename and outputs to another file.

dotless Compiler 1.1.0.7
        Compiles .less files to css files.

Usage: dotless.Compiler.exe [-switches]  [outputfile]
        Switches:
                -m --minify - Output CSS will be compressed
                -w --watch - Watches .less file for changes
                -h --help - Displays this dialog
        inputfile: .less file dotless should compile to CSS
        outputfile: (optional) desired filename for .css output
                 Defaults to inputfile.css

In addition to the above options, the lessc.exe attached accepts less code from the standard input stream and outputs css to standard output stream.

Why

This is useful so that django-compressor and similar modules of the Django framework, which depends on a binary to convert other formats like LESS to CSS work without using another named temporary file.

The default dot less compiler tries to do too much smartness which gets in the way of things. Like it adds a less extension to the filename you passed, even though you dont have a less extension to the actual file.

Source code

The source code is forked on github, Check it out
https://github.com/madaboutcode/dotless

:) Thanks to Ajeesh Mohan for the new code that accepts less from std input. 11 May, 2011
1 Attachment
lessc.zip62.0 KB
Comments (6)
  • WinLess

    I do like the idea behind your program. The only problem is that it uses dotlesscss, which is buggy and behind on the offical compiler: less.js: http://lesscss.org

    I have written a program which does use the less.js compiler. I called it: WinLess.
    Let me quote from what I wrote on stackoverflow:

    "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.

    I would advise against using any compiler which doesn't use less.js to do the actual compiling. less.js is written en maintained by the inventor of LESS, ports like dotlesscss are (as far as I have seen) often buggy and behind on less.js. The tools found on winless.org are based on less.js."

    By Mark Lagendijk on 04 Oct, 2011
  • recursive files.

    Hello there,

    Used your script. Works fantastic for the first listings in a directory until it finds folders. Hopefully, you can adjust the script so that it goes into the folders and compresses those files, for now, it doesn't understand the concept of multidimensional folders.

    Keep up the good work.

    By Anonymous on 25 Sep, 2011
  • Does not recognize @arguments variable in mixins

    compiler sees @arguments as an undefined variable

    By cajazzer on 14 Sep, 2011
  • Variables inside strings do not get parsed

    This is a great start but I found a bug:

    From the lesscss.org website example:

    @base-url: 'http://assets.fnord.com';

    #header{
    background-image: url("@{base-url}/images/bg2.png");
    }

    Does not get compiled correctly. It turns into this:

    #header {
    background-image: url("@{base-url}/images/bg2.png");
    }

    but should turn into this:

    #header {
    background-image: url("http://assets.fnord.com/images/bg2.png");
    }

    Thanks!

    By Matt on 11 Aug, 2011
  • Comments in selector lists

    Hi, great work. The only problem I've found so far is that you are giving syntax errors when there are comments in a selector list, for example:

    h1,
    /*h2,*/
    h3 {
    font-weight: inherit;
    }

    Could well be a problem with the original, but then who needs the original? ;-) It does appear to indicate something very strange with the scanning and parsing.

    I tried less.js but it has many other problems like this, for example it doesn't even understand two consecutive comments, and there is something in RichFaces that conflicts with it, something to do with dropdown menus.

    By EJP on 05 Aug, 2011
  • Not watching changes

    Hi,
    I started using LESS CSS with your lessc.exe and everything seems to work fine except the watch (for changes) function.. Its not generating new version of CSS file..

    Everytime I save LESS file than lessc.exe stops watching it and doesnt generate new version of CSS file.

    I have Win7 Home Premium.

    THX

    By Fana on 02 Aug, 2011
You may also like
Tags
On Facebook
Email Newsletter