Skip to content

Instantly share code, notes, and snippets.

@dinhnguyen
Created October 10, 2012 08:37
Show Gist options
  • Select an option

  • Save dinhnguyen/3864110 to your computer and use it in GitHub Desktop.

Select an option

Save dinhnguyen/3864110 to your computer and use it in GitHub Desktop.
Developing with LESS on Windows: getting lessc comamnd line

Developing with LESS on Windows: getting lessc comamnd line

If you are developing on Windows, and use LESS, you've probably being using some GUI tools to translate *.less to *.css. These work quite good, but what if you still need the lessc command line, which is originally developed by LESS developers? For example, you might need one because you want to compile LESS automatically with your build scripts (or if you're just a command line geek like me)? This is easy on Linux (you may use the one provided with less.js itself), but what about Windows users?

It turns out there is a very clean way to get the lessc command on the Windows command line. It only requires you to install node.js, which is required by the original lessc anyway.

So, install node.js and install "less" module for node.js. The latter provides lessc.cmd 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:

  1. Install node.js
  2. In new command-line, go to node.js installation directory (where node.exe is located), and execute:
 > npm install less

Note that you don't necessarily need to do that from node.js installation directory, but   npm will install the less module to the current directory, and for me - I prefer keeping it altogether with node.js itself.
  1. Latter will download less module for node.js, as well as less.cmd to node_modules/.bin/ directory. Add this directory to your PATH

  2. Now, in new command line you may enjoy the use of lessc as usual

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment