LESS Build Event Script

With the LESS Build Event Script you can easily integrate LESS within your Visual Studio projects.

Note: the LESS Build Event script is deprecated. less.wsf now direcectly supports compiling directories, so LESS Build Script is no longer necessary.

To make it easy for you I added instructions for using less.wsf with Visual Studio projects below.


To use less.wsf in your (pre) build event follow the following steps:

  1. Go to https://github.com/duncansmart/less.js-windows and download the files.
  2. Create a 'Less' folder in the 'Dependencies' folder (or similar) of your solution. Copy 'less.js', 'less.wsf' and 'lessc.cmd' into this folder.
  3. Add the following command to the (pre) build event of your project:

    CALL "$(SolutionDir)Dependencies\Less\lessc" "$(ProjectDir)style\less" "$(ProjectDir)style\css" -compress

    Optionally remove '-compress' if you don't want the resulting css to be minified.

Why should I use less.wsf instead of (solutions based on) dotlesscss?

dotlesscss is a port of less.js. Most LESS compiler tools (like WinLess) use the original LESS compiler, less.js, to compile the LESS files.
When using different tools to compile your LESS files it is important to make sure they use the same compiler.

Created by Mark Lagendijk

Hosting sponsored by RSites